Module bitops_u32

Module bitops_u32 

Source
Expand description

Various bit manipulation operations for the primitive type u32.

All functions are non-mutating but produce a new value.

Functionsยง

clear_bit
Clears the given bit by setting it to 0.
clear_bits
Clears all bits specified in the mask by setting them to 0.
create_mask
Creates a bitmask (1s) with the given amount of contiguous bits.
get_bit
Returns the integer value of the given bit (0 or 1).
get_bits
Returns the requested contiguous bits as new integer.
highest_bit
Returns the highest bit that is set, if any.
is_set
Returns whether the given bit is set.
lowest_bit
Returns the lowest bit that is set, if any.
set_bit
Sets the given bit to 1.
set_bit_exact
Sets the given bit to the given value.
set_bits
Sets the bits of value in base without clearing already set bits.
set_bits_exact
Like set_bits but calls clear_bits beforehand for the relevant bits.
set_bits_exact_n
Combination of set_bits_exact and set_bits_n.
set_bits_n
Version of set_bits that applies a list of multiple values to the base.
toggle_bit
Toggles (flips) the given bit.
toggle_bits
Toggles (flips) the specified contiguous bits.