zerovec::flexzerovec::slice

Function chunk_to_usize

Source
pub(crate) fn chunk_to_usize(chunk: &[u8], width: usize) -> usize
Expand description

Helper function to decode a little-endian “chunk” (byte slice of a specific length) into a usize. We cannot call usize::from_le_bytes directly because that function requires the high bits to be set to 0.