Sound Open Firmware
Loading...
Searching...
No Matches
bit.h File Reference
Include dependency graph for bit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MASK(b_hi, b_lo)    (((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL) << (b_lo))
 
#define SET_BIT(b, x)   (((x) & 1) << (b))
 
#define SET_BITS(b_hi, b_lo, x)    (((x) & ((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL)) << (b_lo))
 
#define GET_BIT(b, x)    (((x) & (1ULL << (b))) >> (b))
 
#define GET_BITS(b_hi, b_lo, x)    (((x) & MASK(b_hi, b_lo)) >> (b_lo))
 

Macro Definition Documentation

◆ GET_BIT

#define GET_BIT (   b,
  x 
)     (((x) & (1ULL << (b))) >> (b))

◆ GET_BITS

#define GET_BITS (   b_hi,
  b_lo,
  x 
)     (((x) & MASK(b_hi, b_lo)) >> (b_lo))

◆ MASK

#define MASK (   b_hi,
  b_lo 
)     (((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL) << (b_lo))

◆ SET_BIT

#define SET_BIT (   b,
  x 
)    (((x) & 1) << (b))

◆ SET_BITS

#define SET_BITS (   b_hi,
  b_lo,
  x 
)     (((x) & ((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL)) << (b_lo))