Skip to main contentModule bitmap
Source - WORD_BITS
- Number of bits per word.
- WORD_MASK
- Mask to extract bit position within a word.
- WORD_SHIFT
- Shift amount to convert bit index to word index.
- clear_all
- Clears all bits.
- clear_bit
- Clears bit
i in the bitmap. - contains_all
- Returns true if all bits set in
mask are also set in snapshot.
Equivalent to: (snapshot & mask) == mask - for_each_set_bit
- Iterates over all set bits in the bitmap, calling
f for each bit index.
Uses Kernighan’s trick with trailing zero count for efficient iteration. - intersects
- Returns true if any bit set in
mask is also set in snapshot.
Equivalent to: (snapshot & mask) != 0 - is_empty
- Returns true if all bits are zero.
- or_into
- Copies
src bitmap OR’d into dst. - set_bit
- Sets bit
i in the bitmap. - swap
- Swaps contents of two bitmaps of the same length.
- test_bit
- Tests if bit
i is set. - word_count
- Returns the number of u64 words needed to represent
n bits.