Expand description
A crate to help with bit manipulation of integers.
§Features
track_calleradds the#[track_caller]attribute on all the functions that assert stuff.
Structs§
- U8Bit
Iter High - Iterator for groups of bits in an integer (low to high).
- U8Bit
Iter Low - Iterator for groups of bits in an integer (low to high).
- U16Bit
Iter High - Iterator for groups of bits in an integer (low to high).
- U16Bit
Iter Low - Iterator for groups of bits in an integer (low to high).
- U32Bit
Iter High - Iterator for groups of bits in an integer (low to high).
- U32Bit
Iter Low - Iterator for groups of bits in an integer (low to high).
- U64Bit
Iter High - Iterator for groups of bits in an integer (low to high).
- U64Bit
Iter Low - Iterator for groups of bits in an integer (low to high).
- U128
BitIter High - Iterator for groups of bits in an integer (low to high).
- U128
BitIter Low - Iterator for groups of bits in an integer (low to high).
- u8x2
- Two
u8values packed as au16.
Constants§
- U8_
SCALE_ 1_ TO_ 8 - When used as a multiplier, scales a “1 bit”
u8to spread the value across all 8 bits. - U8_
SCALE_ 2_ TO_ 8 - When used as a multiplier, scales a “2 bit”
u8to spread the value across all 8 bits. - U8_
SCALE_ 4_ TO_ 8 - When used as a multiplier, scales a “4 bit”
u8to spread the value across all 8 bits.
Functions§
- u8_
bit_ split_ 1x8 - Splits a byte into 1-bit chunks.
- u8_
bit_ split_ 1x8_ rev - Splits a byte into 1-bit chunks (reversed).
- u8_
bit_ split_ 2x4 - Splits a byte into 2-bit chunks.
- u8_
bit_ split_ 2x4_ rev - Splits a byte into 2-bit chunks (reversed).
- u8_
bit_ split_ 4x2 - Splits a byte into 4-bit chunks.
- u8_
bit_ split_ 4x2_ rev - Splits a byte into 4-bit chunks (reversed).
- u8_
get_ bit - Determines if the
bbit is set inu. - u8_
get_ region - Get the
lowtohighbit region ofu. - u8_
get_ value - Get the
lowtohighbit region ofu, down shifted bylow. - u8_
region_ mask - Generates a bit mask where all bits in the region are 1.
- u8_
replicate_ bits - Replicates the lowest
countbits across the entire value. - u8_
with_ bit - Replaces the
bbit inu. - u8_
with_ region - Replaces the
lowtohighbit region ofold. - u8_
with_ value - Replaces the
lowtohighbit region ofoldwith an input up shifted bylow. - u16_
get_ bit - Determines if the
bbit is set inu. - u16_
get_ region - Get the
lowtohighbit region ofu. - u16_
get_ value - Get the
lowtohighbit region ofu, down shifted bylow. - u16_
region_ mask - Generates a bit mask where all bits in the region are 1.
- u16_
replicate_ bits - Replicates the lowest
countbits across the entire value. - u16_
with_ bit - Replaces the
bbit inu. - u16_
with_ region - Replaces the
lowtohighbit region ofold. - u16_
with_ value - Replaces the
lowtohighbit region ofoldwith an input up shifted bylow. - u32_
get_ bit - Determines if the
bbit is set inu. - u32_
get_ region - Get the
lowtohighbit region ofu. - u32_
get_ value - Get the
lowtohighbit region ofu, down shifted bylow. - u32_
region_ mask - Generates a bit mask where all bits in the region are 1.
- u32_
replicate_ bits - Replicates the lowest
countbits across the entire value. - u32_
with_ bit - Replaces the
bbit inu. - u32_
with_ region - Replaces the
lowtohighbit region ofold. - u32_
with_ value - Replaces the
lowtohighbit region ofoldwith an input up shifted bylow. - u64_
get_ bit - Determines if the
bbit is set inu. - u64_
get_ region - Get the
lowtohighbit region ofu. - u64_
get_ value - Get the
lowtohighbit region ofu, down shifted bylow. - u64_
region_ mask - Generates a bit mask where all bits in the region are 1.
- u64_
replicate_ bits - Replicates the lowest
countbits across the entire value. - u64_
with_ bit - Replaces the
bbit inu. - u64_
with_ region - Replaces the
lowtohighbit region ofold. - u64_
with_ value - Replaces the
lowtohighbit region ofoldwith an input up shifted bylow. - u128_
get_ bit - Determines if the
bbit is set inu. - u128_
get_ region - Get the
lowtohighbit region ofu. - u128_
get_ value - Get the
lowtohighbit region ofu, down shifted bylow. - u128_
region_ mask - Generates a bit mask where all bits in the region are 1.
- u128_
replicate_ bits - Replicates the lowest
countbits across the entire value. - u128_
with_ bit - Replaces the
bbit inu. - u128_
with_ region - Replaces the
lowtohighbit region ofold. - u128_
with_ value - Replaces the
lowtohighbit region ofoldwith an input up shifted bylow.