My Kernel v0.1.0

This file contains common (or not) bitwise operations. More...

Collaboration diagram for Bit manipulation:

Macros

#define BIT(_n)   (1 << (_n))
 Generate the nth power of 2 (nth bit set)
 
#define BIT_CLEAR(_var, _n)   (_var &= ~BIT((_n)))
 Clear the nth bit.
 
#define BIT_SET(_var, _n)   (_var |= BIT((_n)))
 Set the nth bit.
 
#define BIT_READ(_x, _n)   ((_x) & BIT((_n)))
 Read the nth bit.
 

Functions

static ALWAYS_INLINE unsigned long bit_first_one (unsigned long word)
 Find the index of the first set bit inside word.
 
static ALWAYS_INLINE unsigned long bit_last_one (unsigned long word)
 Find the index of the last set bit inside word.
 
static ALWAYS_INLINE unsigned long bit_first_zero (unsigned long word)
 Find the index of the first unset bit inside word.
 
static ALWAYS_INLINE unsigned long bit_last_zero (unsigned long word)
 Find the index of the last unset bit inside word.
 
static ALWAYS_INLINE uint32_t bit_next_pow32 (uint32_t val)
 Compute the nex highest power of 2 for a 32bit integer. More...
 

Detailed Description

Function Documentation

◆ bit_next_pow32()

static ALWAYS_INLINE uint32_t bit_next_pow32 ( uint32_t  val)
static