Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
ucp_utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CHKERR_ACTION(_cond, _msg, _log, _action)
 
#define CHKERR_JUMP(_cond, _msg, _log, _label)    CHKERR_ACTION(_cond, _msg, _log, goto _label)
 
#define IS_POW2_OR_ZERO(_n)   !((_n) & ((_n)-1))
 
#define IS_POW2(_n)   (((_n) > 0) && IS_POW2_OR_ZERO(_n))
 
#define PADDING_TO_ALIGN(_n, _alignment)    (((_alignment) - (_n) % (_alignment)) % (_alignment))
 
#define ALIGN_DOWN_POW2(_n, _alignment)   ((_n) & ~((_alignment)-1))
 
#define ALIGN_UP_POW2(_n, _alignment)   ALIGN_DOWN_POW2((_n) + (_alignment)-1, _alignment)
 

Macro Definition Documentation

◆ ALIGN_DOWN_POW2

#define ALIGN_DOWN_POW2 (   _n,
  _alignment 
)    ((_n) & ~((_alignment)-1))

◆ ALIGN_UP_POW2

#define ALIGN_UP_POW2 (   _n,
  _alignment 
)    ALIGN_DOWN_POW2((_n) + (_alignment)-1, _alignment)

◆ CHKERR_ACTION

#define CHKERR_ACTION (   _cond,
  _msg,
  _log,
  _action 
)
Value:
do { \
if(_cond) { \
_log.error() << _msg; \
_action; \
} \
} while(0)

◆ CHKERR_JUMP

#define CHKERR_JUMP (   _cond,
  _msg,
  _log,
  _label 
)     CHKERR_ACTION(_cond, _msg, _log, goto _label)

◆ IS_POW2

#define IS_POW2 (   _n)    (((_n) > 0) && IS_POW2_OR_ZERO(_n))

◆ IS_POW2_OR_ZERO

#define IS_POW2_OR_ZERO (   _n)    !((_n) & ((_n)-1))

◆ PADDING_TO_ALIGN

#define PADDING_TO_ALIGN (   _n,
  _alignment 
)     (((_alignment) - (_n) % (_alignment)) % (_alignment))