pub fn encode<T: Unpackable>(unpacked: &[T], num_bits: usize, packed: &mut [u8])
Expand description
Encodes (packs) a slice of Unpackable
into bitpacked bytes packed
, using num_bits
per value.
This function assumes that the maximum value in unpacked
fits in num_bits
bits
and saturates higher values.
Only the first ceil8(unpacked.len() * num_bits)
of packed
are populated.