RigsofRods
Soft-body Physics Simulation
Macros | Typedefs | Functions
BitFlags.h File Reference

Bit operations. More...

#include <cstdint>
+ Include dependency graph for BitFlags.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BITMASK(OFFSET)   ( 1 << ((OFFSET) - 1) )
 
#define BITMASK64(OFFSET)   ( BitMask64_t(1) << BitMask64_t((OFFSET) - 1) )
 
#define BITMASK_IS_0(VAR, FLAGS)   ( ((VAR) & (FLAGS)) == 0 )
 
#define BITMASK_IS_1(VAR, FLAGS)   ( ((VAR) & (FLAGS)) == (FLAGS) )
 
#define BITMASK_SET_0(VAR, FLAGS)   ( (VAR) &= ~ (FLAGS) )
 
#define BITMASK_SET_1(VAR, FLAGS)   ( (VAR) |= (FLAGS) )
 
#define BITMASK_PROPERTY_GET(VAR, BIT_INDEX, FLAG_NAME, GETTER_NAME)
 Defines a bitmask constant with given bit index (1-indexed) and a getter function. More...
 

Typedefs

typedef uint32_t BitMask_t
 
typedef uint64_t BitMask64_t
 

Functions

void BITMASK_SET (BitMask_t &mask, BitMask_t flag, bool val)
 

Detailed Description

Bit operations.

Definition in file BitFlags.h.

Macro Definition Documentation

◆ BITMASK

#define BITMASK (   OFFSET)    ( 1 << ((OFFSET) - 1) )

Definition at line 10 of file BitFlags.h.

◆ BITMASK64

#define BITMASK64 (   OFFSET)    ( BitMask64_t(1) << BitMask64_t((OFFSET) - 1) )

Definition at line 11 of file BitFlags.h.

◆ BITMASK_IS_0

#define BITMASK_IS_0 (   VAR,
  FLAGS 
)    ( ((VAR) & (FLAGS)) == 0 )

Definition at line 13 of file BitFlags.h.

◆ BITMASK_IS_1

#define BITMASK_IS_1 (   VAR,
  FLAGS 
)    ( ((VAR) & (FLAGS)) == (FLAGS) )

Definition at line 14 of file BitFlags.h.

◆ BITMASK_PROPERTY_GET

#define BITMASK_PROPERTY_GET (   VAR,
  BIT_INDEX,
  FLAG_NAME,
  GETTER_NAME 
)
Value:
static const BitMask_t FLAG_NAME = BITMASK((BIT_INDEX)); \
inline bool GETTER_NAME() const { return BITMASK_IS_1((VAR), FLAG_NAME); }

Defines a bitmask constant with given bit index (1-indexed) and a getter function.

Definition at line 28 of file BitFlags.h.

◆ BITMASK_SET_0

#define BITMASK_SET_0 (   VAR,
  FLAGS 
)    ( (VAR) &= ~ (FLAGS) )

Definition at line 16 of file BitFlags.h.

◆ BITMASK_SET_1

#define BITMASK_SET_1 (   VAR,
  FLAGS 
)    ( (VAR) |= (FLAGS) )

Definition at line 17 of file BitFlags.h.

Typedef Documentation

◆ BitMask64_t

typedef uint64_t BitMask64_t

Definition at line 8 of file BitFlags.h.

◆ BitMask_t

typedef uint32_t BitMask_t

Definition at line 7 of file BitFlags.h.

Function Documentation

◆ BITMASK_SET()

void BITMASK_SET ( BitMask_t mask,
BitMask_t  flag,
bool  val 
)
inline

Definition at line 19 of file BitFlags.h.

+ Here is the caller graph for this function:
BITMASK
#define BITMASK(OFFSET)
Definition: BitFlags.h:10
BITMASK_IS_1
#define BITMASK_IS_1(VAR, FLAGS)
Definition: BitFlags.h:14
BitMask_t
uint32_t BitMask_t
Definition: BitFlags.h:7