]> wimlib.net Git - wimlib/blobdiff - src/lzx-compress.c
Revert "lzx-compress.c: Simplify calculation of position footer"
[wimlib] / src / lzx-compress.c
index 5246e1a1ed3b7add7f7c543c0a240177c3c1218e..360ee9c4e49a528da6b90fe6b26a4249f2ef3998 100644 (file)
@@ -958,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) -
-                               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.  */