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 (
0or1). - 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
valueinbasewithout clearing already set bits. - set_
bits_ exact - Like
set_bitsbut callsclear_bitsbeforehand for the relevant bits. - set_
bits_ exact_ n - Combination of
set_bits_exactandset_bits_n. - set_
bits_ n - Version of
set_bitsthat applies a list of multiple values to the base. - toggle_
bit - Toggles (flips) the given bit.
- toggle_
bits - Toggles (flips) the specified contiguous bits.