X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Flzx_compress.c;h=fdbce434cf794d7ccd3881b39c70bcb61c6d454b;hp=f0c3c5268c82c5e26347b9c42e5c008e811886c8;hb=5d013e4afad9812f8444e8ff02e1146bde050666;hpb=48c386f471f50c2e8d07f9766be2410d401297c1 diff --git a/src/lzx_compress.c b/src/lzx_compress.c index f0c3c526..fdbce434 100644 --- a/src/lzx_compress.c +++ b/src/lzx_compress.c @@ -968,7 +968,8 @@ lzx_write_sequences(struct lzx_output_bitstream *os, int block_type, adjusted_offset = seq->adjusted_offset_and_match_hdr >> 9; num_extra_bits = lzx_extra_offset_bits[offset_slot]; - extra_bits = adjusted_offset - lzx_offset_slot_base[offset_slot]; + extra_bits = adjusted_offset - (lzx_offset_slot_base[offset_slot] + + LZX_OFFSET_ADJUSTMENT); #define MAX_MATCH_BITS (MAIN_CODEWORD_LIMIT + LENGTH_CODEWORD_LIMIT + \ 14 + ALIGNED_CODEWORD_LIMIT) @@ -2762,7 +2763,8 @@ lzx_init_offset_slot_tabs(struct lzx_compressor *c) for (; adjusted_offset < ARRAY_LEN(c->offset_slot_tab_1); adjusted_offset++) { - if (adjusted_offset >= lzx_offset_slot_base[slot + 1]) + if (adjusted_offset >= lzx_offset_slot_base[slot + 1] + + LZX_OFFSET_ADJUSTMENT) slot++; c->offset_slot_tab_1[adjusted_offset] = slot; } @@ -2771,7 +2773,8 @@ lzx_init_offset_slot_tabs(struct lzx_compressor *c) for (; adjusted_offset < LZX_MAX_WINDOW_SIZE; adjusted_offset += (u32)1 << 14) { - if (adjusted_offset >= lzx_offset_slot_base[slot + 1]) + if (adjusted_offset >= lzx_offset_slot_base[slot + 1] + + LZX_OFFSET_ADJUSTMENT) slot++; c->offset_slot_tab_2[adjusted_offset >> 14] = slot; }