From 86016ddd3e36b4c5f119d0d1387f8fad527a246e Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 6 Sep 2014 20:49:02 -0500 Subject: [PATCH] lzx_decompress_block(): One-branch check for aligned offset case --- src/lzx-decompress.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lzx-decompress.c b/src/lzx-decompress.c index c8ce9b04..58d1f6b1 100644 --- a/src/lzx-decompress.c +++ b/src/lzx-decompress.c @@ -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 { -- 2.43.0