From: Hans Kristian Rosbach Date: Tue, 5 May 2020 09:19:37 +0000 (+0200) Subject: Remove several NOT_TWEAK_COMPILER checks and their legacy code. X-Git-Tag: 1.9.9-b1~308 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6884f3715c5228fd733b8efa27ea71f6cf792c7d;p=thirdparty%2Fzlib-ng.git Remove several NOT_TWEAK_COMPILER checks and their legacy code. --- diff --git a/deflate.c b/deflate.c index 937927632..81068ffbe 100644 --- 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 diff --git a/deflate.h b/deflate.h index 97519e2a9..61b498e75 100644 --- 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 diff --git a/deflate_fast.c b/deflate_fast.c index 9efda4781..1277b773a 100644 --- a/deflate_fast.c +++ b/deflate_fast.c @@ -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; diff --git a/deflate_medium.c b/deflate_medium.c index 4e5d0949d..d5fbfe71b 100644 --- a/deflate_medium.c +++ b/deflate_medium.c @@ -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; diff --git a/deflate_slow.c b/deflate_slow.c index b8b15982c..1e5bffc0c 100644 --- a/deflate_slow.c +++ b/deflate_slow.c @@ -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);