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)   ((a) < (b) ? (a) : (b))
 Select minum value.
 
#define ROC_MAX(a, b)   ((a) > (b) ? (a) : (b))
 Select minum value.
 
#define ROC_ARRAY_SIZE(a)   (sizeof(a) / sizeof((a)[0]))
 Get number of elements in a static array.
 
#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.
 
#define ROC_STRINGIZE_(s)   #s
 Stringize macro helper.
 
#define ROC_STRINGIZE(s)   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)    (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 27 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_MIN

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

Select minum value.

Definition at line 18 of file macro_helpers.h.

◆ ROC_STRINGIZE

#define ROC_STRINGIZE (   s)    ROC_STRINGIZE_(s)

Stringize macro.

Definition at line 34 of file macro_helpers.h.

◆ ROC_STRINGIZE_

#define ROC_STRINGIZE_ (   s)    #s

Stringize macro helper.

Definition at line 31 of file macro_helpers.h.