Skip to main content

Module bits

Module bits 

Source
Expand description

Bit manipulation utilities

Functionsยง

align_down
Aligns a value down to the given alignment
align_up
Aligns a value up to the given alignment
count_ones
Returns the number of set bits in a u64
is_aligned
Checks if a value is aligned to the given alignment
leading_zeros
Returns the number of leading zeros in a u64
log2_ceil
Returns the log2 of x, rounded up
log2_floor
Returns the log2 of x, rounded down
next_power_of_two
Returns the next power of two greater than or equal to x
trailing_zeros
Returns the number of trailing zeros in a u64