Atrinik Server  4.0
Macros
Object flag macros

Macros

#define FLAG_BITMASK(p)   BIT_MASK(p % 32)
 
#define SET_FLAG(xyz, p)   BIT_SET((xyz)->flags[p / 32], p % 32)
 
#define CLEAR_FLAG(xyz, p)   BIT_CLEAR((xyz)->flags[p / 32], p % 32)
 
#define QUERY_FLAG(xyz, p)   BIT_QUERY((xyz)->flags[p / 32], p % 32)
 
#define FLIP_FLAG(xyz, p)   BIT_FLIP((xyz)->flags[p / 32], p % 32)
 
#define CHANGE_FLAG(op, flag, cond)   BIT_CHANGE((op)->flags[flag / 32], flag % 32, cond)
 

Detailed Description

Basic macros to do the above.

Macro Definition Documentation

#define CHANGE_FLAG (   op,
  flag,
  cond 
)    BIT_CHANGE((op)->flags[flag / 32], flag % 32, cond)

Utility macro to set or clear an object's flag depending on whether the cond evaluates to true or false.

Parameters
opObject to set or clear the flag for
flagThe flag we're setting/clearing
condIf true, will set the flag, will clear otherwise.

Definition at line 784 of file define.h.

#define CLEAR_FLAG (   xyz,
 
)    BIT_CLEAR((xyz)->flags[p / 32], p % 32)

Clear flag of an object.

Parameters
xyzThe object
pThe flag to clear

Definition at line 751 of file define.h.

#define FLAG_BITMASK (   p)    BIT_MASK(p % 32)

Macro for getting flag's bitmask value.

Definition at line 732 of file define.h.

#define FLIP_FLAG (   xyz,
 
)    BIT_FLIP((xyz)->flags[p / 32], p % 32)

Flip flag of an object.

Parameters
xyzThe object.
pThe flag to flip.

Definition at line 771 of file define.h.

#define QUERY_FLAG (   xyz,
 
)    BIT_QUERY((xyz)->flags[p / 32], p % 32)

Query flag of an object.

Parameters
xyzThe object
pThe flag to query

Definition at line 761 of file define.h.

#define SET_FLAG (   xyz,
 
)    BIT_SET((xyz)->flags[p / 32], p % 32)

Set flag of of an object.

Parameters
xyzThe object
pThe flag to set

Definition at line 741 of file define.h.