]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove several NOT_TWEAK_COMPILER checks and their legacy code.
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 5 May 2020 09:19:37 +0000 (11:19 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 6 May 2020 08:00:11 +0000 (10:00 +0200)
deflate.c
deflate.h
deflate_fast.c
deflate_medium.c
deflate_slow.c

index 937927632ecbc62b0956a4600c3b32ecbb361185..81068ffbef00b7cdf5fc0396e506f12bece945cf 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -223,8 +223,8 @@ ZLIB_INTERNAL void slide_hash_c(deflate_state *s) {
             *q++ = (Pos)(m >= t ? m-t: NIL);
         }
     }
-
 #endif /* NOT_TWEAK_COMPILER */
+
     n = wsize;
     p = &s->prev[n];
 #ifdef NOT_TWEAK_COMPILER
index 97519e2a90ae09c99ad9d139ea851f0c95745af7..61b498e7540d45a2a4751a7fcdd992566c8e1665 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -390,11 +390,7 @@ void ZLIB_INTERNAL flush_pending(PREFIX3(streamp) strm);
  * used.
  */
 
-#ifdef NOT_TWEAK_COMPILER
-#  define TRIGGER_LEVEL 6
-#else
-#  define TRIGGER_LEVEL 5
-#endif
+#define TRIGGER_LEVEL 5
 
 /* Bit buffer and compress bits calculation debugging */
 #ifdef ZLIB_DEBUG
index 9efda47816e88e8d95951792d2d39dc1590de0df..1277b773a53b86dfe51b1454c84fc2926c4a1ed9 100644 (file)
@@ -68,21 +68,10 @@ ZLIB_INTERNAL block_state deflate_fast(deflate_state *s, int flush) {
             if (s->match_length <= s->max_insert_length && s->lookahead >= MIN_MATCH) {
                 s->match_length--; /* string at strstart already in table */
                 s->strstart++;
-#ifdef NOT_TWEAK_COMPILER
-                do {
-                    functable.quick_insert_string(s, s->strstart);
-                    s->strstart++;
-                    /* strstart never exceeds WSIZE-MAX_MATCH, so there are
-                     * always MIN_MATCH bytes ahead.
-                     */
-                } while (--s->match_length != 0);
-#else
-                {
-                    functable.insert_string(s, s->strstart, s->match_length);
-                    s->strstart += s->match_length;
-                    s->match_length = 0;
-                }
-#endif
+
+                functable.insert_string(s, s->strstart, s->match_length);
+                s->strstart += s->match_length;
+                s->match_length = 0;
             } else {
                 s->strstart += s->match_length;
                 s->match_length = 0;
index 4e5d0949dbe1543cf9741db6f870d5e048b3d9a1..d5fbfe71bc4e24c47e80165b3cabe0f653bdab19 100644 (file)
@@ -49,18 +49,6 @@ static void insert_match(deflate_state *s, struct match match) {
 
     /* matches that are not long enough we need to emit as literals */
     if (match.match_length < MIN_MATCH) {
-#ifdef NOT_TWEAK_COMPILER
-        while (match.match_length) {
-            match.strstart++;
-            match.match_length--;
-
-            if (match.match_length) {
-                if (match.strstart >= match.orgstart) {
-                    functable.quick_insert_string(s, match.strstart);
-                }
-            }
-        }
-#else
         match.strstart++;
         match.match_length--;
         if (match.match_length > 0) {
@@ -74,7 +62,6 @@ static void insert_match(deflate_state *s, struct match match) {
                 match.match_length = 0;
             }
         }
-#endif
         return;
     }
 
@@ -84,17 +71,7 @@ static void insert_match(deflate_state *s, struct match match) {
     if (match.match_length <= 16* s->max_insert_length && s->lookahead >= MIN_MATCH) {
         match.match_length--; /* string at strstart already in table */
         match.strstart++;
-#ifdef NOT_TWEAK_COMPILER
-        do {
-            if (LIKELY(match.strstart >= match.orgstart)) {
-                functable.quick_insert_string(s, match.strstart);
-            }
-            match.strstart++;
-            /* strstart never exceeds WSIZE-MAX_MATCH, so there are
-             * always MIN_MATCH bytes ahead.
-             */
-        } while (--match.match_length != 0);
-#else
+
         if (LIKELY(match.strstart >= match.orgstart)) {
             if (LIKELY(match.strstart + match.match_length - 1 >= match.orgstart)) {
                 functable.insert_string(s, match.strstart, match.match_length);
@@ -106,7 +83,6 @@ static void insert_match(deflate_state *s, struct match match) {
         }
         match.strstart += match.match_length;
         match.match_length = 0;
-#endif
     } else {
         match.strstart += match.match_length;
         match.match_length = 0;
index b8b15982c6b4898a245bd7104b2087e8e4b63a2e..1e5bffc0c9095fbbc869c6d70a15e5cf715c4054 100644 (file)
@@ -95,32 +95,18 @@ ZLIB_INTERNAL block_state deflate_slow(deflate_state *s, int flush) {
              */
             s->lookahead -= s->prev_length-1;
 
-#ifdef NOT_TWEAK_COMPILER
-            s->prev_length -= 2;
-            do {
-                if (++s->strstart <= max_insert) {
-                    functable.quick_insert_string(s, s->strstart);
-                }
-            } while (--s->prev_length != 0);
+            unsigned int mov_fwd = s->prev_length - 2;
+            if (max_insert > s->strstart) {
+                unsigned int insert_cnt = mov_fwd;
+                if (UNLIKELY(insert_cnt > max_insert - s->strstart))
+                    insert_cnt = max_insert - s->strstart;
+
+                functable.insert_string(s, s->strstart + 1, insert_cnt);
+            }
+            s->prev_length = 0;
             s->match_available = 0;
             s->match_length = MIN_MATCH-1;
-            s->strstart++;
-#else
-            {
-                unsigned int mov_fwd = s->prev_length - 2;
-                if (max_insert > s->strstart) {
-                    unsigned int insert_cnt = mov_fwd;
-                    if (UNLIKELY(insert_cnt > max_insert - s->strstart))
-                        insert_cnt = max_insert - s->strstart;
-
-                    functable.insert_string(s, s->strstart + 1, insert_cnt);
-                }
-                s->prev_length = 0;
-                s->match_available = 0;
-                s->match_length = MIN_MATCH-1;
-                s->strstart += mov_fwd + 1;
-            }
-#endif /*NOT_TWEAK_COMPILER*/
+            s->strstart += mov_fwd + 1;
 
             if (bflush)
                 FLUSH_BLOCK(s, 0);