Embedded Artistry Framework
Embedded Systems C++ Framework
bits.h File Reference
This graph shows which files directly or indirectly include this file:

Macros

Alignment Macros
#define align_up(num, align)   (((num) + ((align)-1)) & ~((align)-1))
 Increase a number to the next aligned value. More...
 
#define IS_POWER_2(x)   (!((x) & ((x)-1)))
 Check if a number is a power of 2. More...
 
#define IS_ALIGNED(val, align)   ((val & (align - 1)) == 0)
 Check if a value is aligned. More...
 
Bitfield Macros
#define SET_BIT(x)   (1 << x)
 Set bit at position X. More...
 
#define EXTRACT_BITFIELD(value, high_bit, low_bit)   (((value) >> (low_bit)) & N_SET_BITS((high_bit) - (low_bit) + 1))
 Extract a field of bits from a value. More...
 
Count Bits Macros
#define N_SET_BITS(n_ones)   ((1 << (n_ones)) - 1)
 Count the number of set bits. More...