]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Minor prev_length calculation improvement in deflate_slow.
authorNathan Moinvaziri <nathan@nathanm.com>
Tue, 15 Jun 2021 00:42:24 +0000 (17:42 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 25 Jun 2021 18:09:14 +0000 (20:09 +0200)
deflate_slow.c

index a3af11bcfee4be86fc1053c3d974af8503bd7bc4..e0232c0a13687c7e1b54f14831b75ea2b443c48b 100644 (file)
@@ -81,9 +81,10 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) {
              * enough lookahead, the last two strings are not inserted in
              * the hash table.
              */
-            s->lookahead -= s->prev_length-1;
+            s->prev_length -= 1;
+            s->lookahead -= s->prev_length;
 
-            unsigned int mov_fwd = s->prev_length - 2;
+            unsigned int mov_fwd = s->prev_length - 1;
             if (max_insert > s->strstart) {
                 unsigned int insert_cnt = mov_fwd;
                 if (UNLIKELY(insert_cnt > max_insert - s->strstart))