Module bits

Source
Expand description

Utilities for bit manipulation.

Functions§

contains_ones_byte_u16
Returns true if the unsigned 16-bit integer contains one or more bytes which have all bits set.
contains_ones_byte_u32
Returns true if the unsigned 32-bit integer contains one or more bytes which have all bits set.
contains_ones_byte_u64
Returns true if the unsigned 64-bit integer contains one or more bytes which have all bits set.
mask_at
Masks the bit at the specified bit index.
mask_lower
Masks all bits with an index less than idx.
mask_lower_eq
Masks all bits with an index less than or equal to idx.
mask_range
Masks out all bits in positions less than upper, but greater than or equal to lower (upper < bit <= lower)
mask_upper
Masks all bits with an index greater than idx.
mask_upper_eq
Masks all bits with an index greater than or equal to idx.
sign_extend_leq8_to_i8
Sign extends an arbitrary, 8-bit or less, signed two’s complement integer stored within an u8 to a full width i8.
sign_extend_leq16_to_i16
Sign extends an arbitrary, 16-bit or less, signed two’s complement integer stored within an u16 to a full width i16.
sign_extend_leq32_to_i32
Sign extends an arbitrary, 32-bit or less, signed two’s complement integer stored within an u32 to a full width i32.
sign_extend_leq64_to_i64
Sign extends an arbitrary, 64-bit or less, signed two’s complement integer stored within an u64 to a full width i64.
trailing_ones_u8
Returns the number of trailing ones in an unsigned 8-bit integer.
trailing_ones_u16
Returns the number of trailing ones in an unsigned 16-bit integer.
trailing_ones_u32
Returns the number of trailing ones in an unsigned 32-bit integer.
trailing_ones_u64
Returns the number of trailing ones in an unsigned 64-bit integer.