pub fn decode_bits(
bits: u64,
nbits: u32,
table: &CodeTable,
dict_bits: u32,
) -> Result<BitDecodeOutput<Symbol>>Expand description
Decodes the input bits into a symbol.
decode_bits is the core of the decompression. It takes in the bit buffer, code table, and dict_bits, and outputs 1 decoded symbol. nbits should reflect the amount of bits in the bit buffer, but is only used for error checking. dict_bits is the real dict_bits - 6, because it represents the literal dict bits. (6 bits are always coded using Shannon Fano codes.) For example, a dictionary size of 4096 (2^12) would have a dict_bits value of 6 because 12 - 6 is 6. Beware that this value is limited from 4 to 6 in the PKWARE® implementation. This implementation has no such restriction.
§Examples
use implode;
assert_eq!(implode::Symbol::Literal(0), implode::decode_bits(0, 9, &implode::DEFAULT_CODE_TABLE));§Errors
If nbits is less than 1, returns BitDecodeError::NotEnoughBits(1). If the bit stream indicates a literal, and nbits is less than 9, returns BitDecodeError::NotEnoughBits(9-nbits).