]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove duplicate calculations in deflate_quick().
authorNathan Moinvaziri <nathan@nathanm.com>
Tue, 25 Feb 2020 14:20:54 +0000 (06:20 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 13 Mar 2020 13:27:35 +0000 (14:27 +0100)
arch/x86/deflate_quick.c

index 9f6d6b6d9692823282dbc499d299d730c915c460..74b9046006d1b1b5bb88dee0bdd366875fca5266 100644 (file)
@@ -238,7 +238,7 @@ ZLIB_INTERNAL block_state deflate_quick(deflate_state *s, int flush) {
             dist = s->strstart - hash_head;
 
             if (dist > 0 && (dist-1) < (s->w_size - 1)) {
-                match_len = compare258(s->window + s->strstart, s->window + s->strstart - dist);
+                match_len = compare258(s->window + s->strstart, s->window + hash_head);
 
                 if (match_len >= MIN_MATCH) {
                     if (match_len > s->lookahead)
@@ -247,7 +247,7 @@ ZLIB_INTERNAL block_state deflate_quick(deflate_state *s, int flush) {
                     if (match_len > MAX_MATCH)
                         match_len = MAX_MATCH;
 
-                    static_emit_ptr(s, match_len - MIN_MATCH, s->strstart - hash_head);
+                    static_emit_ptr(s, match_len - MIN_MATCH, dist);
                     s->lookahead -= match_len;
                     s->strstart += match_len;
                     continue;