Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
macro_helpers.h File Reference

Helper macros. More...

#include "roc_core/stddefs.h"

Go to the source code of this file.

Macros

#define ROC_MIN(a, b)
 Select minum value.
 
#define ROC_MAX(a, b)
 Select minum value.
 
#define ROC_ARRAY_SIZE(a)
 Get number of elements in a static array.
 
#define ROC_MIN_OF(type)
 Get minimum value of signed or unsigned integer type.
 
#define ROC_MAX_OF(type)
 Get maximum value of signed or unsigned integer type.
 
#define ROC_CONTAINER_OF(ptr, type, member)
 Cast a member of a structure out to the containing structure.
 
#define ROC_STRINGIZE_(s)
 Stringize macro helper.
 
#define ROC_STRINGIZE(s)
 Stringize macro.
 

Detailed Description

Helper macros.

Definition in file macro_helpers.h.

Macro Definition Documentation

◆ ROC_ARRAY_SIZE

#define ROC_ARRAY_SIZE ( a)
Value:
(sizeof(a) / sizeof((a)[0]))

Get number of elements in a static array.

Definition at line 24 of file macro_helpers.h.

◆ ROC_CONTAINER_OF

#define ROC_CONTAINER_OF ( ptr,
type,
member )
Value:
(reinterpret_cast<type*>((char*)(ptr)-offsetof(type, member)))

Cast a member of a structure out to the containing structure.

Definition at line 37 of file macro_helpers.h.

◆ ROC_MAX

#define ROC_MAX ( a,
b )
Value:
((a) > (b) ? (a) : (b))

Select minum value.

Definition at line 21 of file macro_helpers.h.

◆ ROC_MAX_OF

#define ROC_MAX_OF ( type)
Value:
((type)-1 > (type)0 ? (type)(~0ull) \
: (type)((1ull << ((sizeof(type) * 8) - 1)) - 1ull))

Get maximum value of signed or unsigned integer type.

Definition at line 32 of file macro_helpers.h.

◆ ROC_MIN

#define ROC_MIN ( a,
b )
Value:
((a) < (b) ? (a) : (b))

Select minum value.

Definition at line 18 of file macro_helpers.h.

◆ ROC_MIN_OF

#define ROC_MIN_OF ( type)
Value:
((type)-1 > (type)0 ? (type)0 \
: (type)((~0ull) - ((1ull << ((sizeof(type) * 8) - 1)) - 1ull)))

Get minimum value of signed or unsigned integer type.

Definition at line 27 of file macro_helpers.h.

◆ ROC_STRINGIZE

#define ROC_STRINGIZE ( s)
Value:
#define ROC_STRINGIZE_(s)
Stringize macro helper.

Stringize macro.

Definition at line 44 of file macro_helpers.h.

◆ ROC_STRINGIZE_

#define ROC_STRINGIZE_ ( s)
Value:
#s

Stringize macro helper.

Definition at line 41 of file macro_helpers.h.