/* Codewords for the LZX main, length, and aligned offset Huffman codes */
struct lzx_codewords {
- u16 main[LZX_MAINCODE_MAX_NUM_SYMBOLS];
- u16 len[LZX_LENCODE_NUM_SYMBOLS];
- u16 aligned[LZX_ALIGNEDCODE_NUM_SYMBOLS];
+ u32 main[LZX_MAINCODE_MAX_NUM_SYMBOLS];
+ u32 len[LZX_LENCODE_NUM_SYMBOLS];
+ u32 aligned[LZX_ALIGNEDCODE_NUM_SYMBOLS];
};
/* Codeword lengths (in bits) for the LZX main, length, and aligned offset
input_idx_t precode_freqs[restrict LZX_PRECODE_NUM_SYMBOLS],
u8 output_syms[restrict num_syms],
u8 precode_lens[restrict LZX_PRECODE_NUM_SYMBOLS],
- u16 precode_codewords[restrict LZX_PRECODE_NUM_SYMBOLS],
+ u32 precode_codewords[restrict LZX_PRECODE_NUM_SYMBOLS],
unsigned *num_additional_bits_ret)
{
memset(precode_freqs, 0,
input_idx_t precode_freqs[LZX_PRECODE_NUM_SYMBOLS];
u8 output_syms[num_syms];
u8 precode_lens[LZX_PRECODE_NUM_SYMBOLS];
- u16 precode_codewords[LZX_PRECODE_NUM_SYMBOLS];
+ u32 precode_codewords[LZX_PRECODE_NUM_SYMBOLS];
unsigned i;
unsigned num_output_syms;
u8 precode_sym;
/* The match offset shall be encoded as a position slot (itself encoded
* as part of the main symbol) and a position footer. */
position_slot = lzx_get_position_slot(match_offset, queue);
- position_footer = (match_offset + LZX_OFFSET_OFFSET) -
- lzx_position_base[position_slot];
+ position_footer = (match_offset + LZX_OFFSET_OFFSET) &
+ ((1U << lzx_get_num_extra_bits(position_slot)) - 1);
/* The match length shall be encoded as a length header (itself encoded
* as part of the main symbol) and an optional length footer. */