Module bits

Expand description

Bitwise operations for creating tightly packed impls of SlabItem.

The functions and constants in this module are utilities to help when writing manual implementations of SlabItem.

Using these functions it’s possible to “tightly pack” struct fields.

Constants§

U8_0_BITS
The shift/mask range for the first 8 bits of a u32.
U8_1_BITS
The shift/mask range for the second 8 bits of a u32.
U8_2_BITS
The shift/mask range for the third 8 bits of a u32.
U8_3_BITS
The shift/mask range for the fourth 8 bits of a u32.
U16_0_BITS
The shift/mask range for the first 16 bits of a u32.
U16_1_BITS
The shift/mask range for the second 16 bits of a u32.

Functions§

bits
Statically define a shift/mask range as a literal range of bits.
extract
Extract the value of the bits defined by the shift/mask range.
extract_f32
Extract 32 bits of the u32 at the given index in the slab.
extract_i8
Extract 8 bits of the u32 at the given index in the slab.
extract_i16
Extract 16 bits of the u32 at the given index in the slab.
extract_i32
Extract 32 bits of the u32 at the given index in the slab.
extract_u8
Extract 8 bits of the u32 at the given index in the slab.
extract_u16
Extract 16 bits of the u32 at the given index in the slab.
extract_u32
Extract 32 bits of the u32 at the given index in the slab.
insert
Insert the value of the bits defined by the shift/mask range.