]> wimlib.net Git - wimlib/blobdiff - src/lzx-decompress.c
lzx_decompress_block(): One-branch check for aligned offset case
[wimlib] / src / lzx-decompress.c
index c8ce9b049c025aa713367d74775c4920c0fe8f71..58d1f6b1e75fdcca283a0863534462312a52e44e 100644 (file)
@@ -430,6 +430,7 @@ lzx_decompress_block(int block_type, u32 block_size,
        unsigned position_slot;
        u32 match_offset;
        unsigned num_extra_bits;
+       unsigned ones_if_aligned = 0U - (block_type == LZX_BLOCKTYPE_ALIGNED);
 
        while (window_ptr != window_end) {
 
@@ -475,7 +476,9 @@ lzx_decompress_block(int block_type, u32 block_size,
                        /* In aligned offset blocks, the low-order 3 bits of
                         * each offset are encoded using the aligned offset
                         * code.  Otherwise, all the extra bits are literal.  */
-                       if (block_type == LZX_BLOCKTYPE_ALIGNED && num_extra_bits >= 3) {
+
+                       /*if (block_type == LZX_BLOCKTYPE_ALIGNED && num_extra_bits >= 3) {*/
+                       if ((num_extra_bits & ones_if_aligned) >= 3) {
                                match_offset += bitstream_read_bits(istream, num_extra_bits - 3) << 3;
                                match_offset += read_huffsym_using_alignedcode(istream, tables);
                        } else {