49#define _ONE(x) (1 + ((x) - (x)))
50#define BIT(n) (1U << (n))
51#define BIT_GET(x, bit) ((x) & (_ONE(x) << (bit)))
52#define BIT_SHIFT(x, bit) (((x) >> (bit)) & 1)
53#define BITS_GET(x, high, low) ((x) & (((_ONE(x) << ((high) + 1)) - 1) & ~((_ONE(x) << (low)) - 1)))
54#define BITS_SHIFT(x, high, low) (((x) >> (low)) & ((_ONE(x) << ((high) - (low) + 1)) - 1))
55#define BIT_SET(x, bit) (((x) & (_ONE(x) << (bit))) ? 1 : 0)
56#define BITMAP_BITS_PER_WORD (sizeof(UINTPTR) * 8)
57#define BITMAP_NUM_WORDS(x) (((x) + BITMAP_BITS_PER_WORD - 1) / BITMAP_BITS_PER_WORD)
58#define BITMAP_WORD(x) ((x) / BITMAP_BITS_PER_WORD)
59#define BITMAP_BIT_IN_WORD(x) ((x) & (BITMAP_BITS_PER_WORD - 1))
60#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITMAP_BITS_PER_WORD))
61#define BITMAP_LAST_WORD_MASK(nbits) \
62 (((nbits) % BITMAP_BITS_PER_WORD) ? (1UL << ((nbits) % BITMAP_BITS_PER_WORD)) - 1 : ~0UL)
63#define BITMAP_BITS_PER_INT (sizeof(INTPTR) * 8)
64#define BITMAP_BIT_IN_INT(x) ((x) & (BITMAP_BITS_PER_INT - 1))
65#define BITMAP_INT(x) ((x) / BITMAP_BITS_PER_INT)
66#define BIT_MASK(x) (((x) >= sizeof(UINTPTR) * 8) ? (0UL - 1) : ((1UL << (x)) - 1))
74#define LOS_INVALID_BIT_INDEX 32
VOID LOS_BitmapSet(UINT32 *bitmap, UINT16 pos)
Set one bit.
VOID LOS_BitmapClr(UINT32 *bitmap, UINT16 pos)
Clear one bit.
UINT16 LOS_LowBitGet(UINT32 bitmap)
Find the lowest one bit that is set.
VOID LOS_BitmapClrNBits(UINTPTR *bitmap, UINT32 start, UINT32 numsClear)
Clear the number of bit to zero from start.
UINT16 LOS_HighBitGet(UINT32 bitmap)
Find the highest one bit that is set.
int LOS_BitmapFfz(UINTPTR *bitmap, UINT32 numBits)
Find the first zero bit starting from LSB.
VOID LOS_BitmapSetNBits(UINTPTR *bitmap, UINT32 start, UINT32 numsSet)
Set the number of bit to 1 from start.