comp_decode

Function comp_decode 

Source
pub fn comp_decode(d: &[u8], v: &mut [i16]) -> bool
Expand description

Encode small integers from bytes using a compressed (Golomb-Rice) format.

Decode the provided source buffer d into signed integers v, using the compressed encoding convention. This function returns false in any of the following cases:

  • Source does not contain enough encoded integers to fill v entirely.
  • An invalid encoding for a value is encountered.
  • Any of the remaining unused bits in d (after all integers have been decoded) is non-zero.

Valid encodings cover exactly the integers in the [-2047,+2047] range. For a given sequence of integers, there is only one valid encoding as a sequence of bytes (of a given length).