X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Flzx-compress.c;h=5246e1a1ed3b7add7f7c543c0a240177c3c1218e;hp=308c7bf11a728548d6ef60eb3d8ab0211dc52ced;hb=6d0470be4d1855a0ea254e788e9ced23fc36dfb7;hpb=260370b878a0b1d2351164ae882407ba7de52616 diff --git a/src/lzx-compress.c b/src/lzx-compress.c index 308c7bf1..5246e1a1 100644 --- a/src/lzx-compress.c +++ b/src/lzx-compress.c @@ -456,9 +456,6 @@ lzx_write_match(struct output_bitstream *out, int block_type, * MIN_MATCH_LEN. */ if (match_len_minus_2 < LZX_NUM_PRIMARY_LENS) { len_header = match_len_minus_2; - /* No length footer-- mark it with a special - * value. */ - len_footer = (unsigned)(-1); } else { len_header = LZX_NUM_PRIMARY_LENS; len_footer = match_len_minus_2 - LZX_NUM_PRIMARY_LENS; @@ -478,10 +475,9 @@ lzx_write_match(struct output_bitstream *out, int block_type, /* If there is a length footer, output it using the * length Huffman code. */ - if (len_footer != (unsigned)(-1)) { + if (len_header == LZX_NUM_PRIMARY_LENS) bitstream_put_bits(out, codes->codewords.len[len_footer], codes->lens.len[len_footer]); - } num_extra_bits = lzx_get_num_extra_bits(position_slot); @@ -962,8 +958,8 @@ lzx_tally_match(unsigned match_len, unsigned match_offset, /* 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) & - ((1U << lzx_get_num_extra_bits(position_slot)) - 1); + position_footer = (match_offset + LZX_OFFSET_OFFSET) - + lzx_position_base[position_slot]; /* The match length shall be encoded as a length header (itself encoded * as part of the main symbol) and an optional length footer. */ @@ -1592,7 +1588,11 @@ lzx_compress(const void *uncompressed_data, size_t uncompressed_size, * Although this could be disabled by default in all cases, it only * takes around 2-3% of the running time of the slow algorithm to do the * verification. */ -#if defined(ENABLE_LZX_DEBUG) || defined(ENABLE_VERIFY_COMPRESSION) + if (ctx->params.algorithm == WIMLIB_LZX_ALGORITHM_SLOW + #if defined(ENABLE_LZX_DEBUG) || defined(ENABLE_VERIFY_COMPRESSION) + || 1 + #endif + ) { struct wimlib_decompressor *decompressor; @@ -1626,7 +1626,6 @@ lzx_compress(const void *uncompressed_data, size_t uncompressed_size, "data verification!"); } } -#endif return compressed_size; }