Macros
flag.h File Reference

Helper macros for bitwise flag manipulation. More...

Macros

#define vtm_flag_set(VAL, FLAG)   (VAL) |= (FLAG)
 
#define vtm_flag_unset(VAL, FLAG)   (VAL) &= ~(FLAG)
 
#define vtm_flag_is_set(VAL, FLAG)   ((VAL) & (FLAG)) == (FLAG)
 

Macro Definition Documentation

#define vtm_flag_set (   VAL,
  FLAG 
)    (VAL) |= (FLAG)

Set bits

Parameters
VALthe value where bits should be set
FLAGbits which should be set to 1
#define vtm_flag_unset (   VAL,
  FLAG 
)    (VAL) &= ~(FLAG)

Unset bits

Parameters
VALthe value where bits should unset
FLAGbits which should be set to 0
#define vtm_flag_is_set (   VAL,
  FLAG 
)    ((VAL) & (FLAG)) == (FLAG)

Check if bits are set

Parameters
VALthe value where bits should be checked
FLAGbits which should be tested