Skip to main content

pack_nibbles

Function pack_nibbles 

Source
pub fn pack_nibbles(codes: &[i8]) -> Vec<u8> ⓘ
Expand description

Pack signed 4-bit codes ([-7, 7]) into bytes, two nibbles per byte, low nibble first. The nibble is the two’s-complement low 4 bits, so -7..=7 maps to 0x9..=0x7 and unpacks back exactly via sign extension.