Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
macro_helpers.h File Reference

Helper macros. More...

#include "roc_core/stddefs.h"
Include dependency graph for macro_helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ROC_MIN(a, b)   ((a) < (b) ? (a) : (b))
 Select minum value. More...
 
#define ROC_MAX(a, b)   ((a) > (b) ? (a) : (b))
 Select minum value. More...
 
#define ROC_ARRAY_SIZE(a)   (sizeof(a) / sizeof((a)[0]))
 Get number of elements in a static array. More...
 
#define ROC_MIN_OF(type)
 Get minimum value of signed or unsigned integer type. More...
 
#define ROC_MAX_OF(type)
 Get maximum value of signed or unsigned integer type. More...
 
#define ROC_CONTAINER_OF(ptr, type, member)    (reinterpret_cast<type*>((char*)(ptr)-offsetof(type, member)))
 Cast a member of a structure out to the containing structure. More...
 
#define ROC_STRINGIZE_(s)   #s
 Stringize macro helper. More...
 
#define ROC_STRINGIZE(s)   ROC_STRINGIZE_(s)
 Stringize macro. More...
 

Detailed Description

Helper macros.

Definition in file macro_helpers.h.

Macro Definition Documentation

◆ ROC_ARRAY_SIZE

#define ROC_ARRAY_SIZE (   a)    (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 
)     (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,
 
)    ((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,
 
)    ((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)    ROC_STRINGIZE_(s)

Stringize macro.

Definition at line 44 of file macro_helpers.h.

◆ ROC_STRINGIZE_

#define ROC_STRINGIZE_ (   s)    #s

Stringize macro helper.

Definition at line 41 of file macro_helpers.h.