From: Mika Lindqvist Date: Wed, 24 Jun 2015 18:34:32 +0000 (+0300) Subject: Use bulk_insert_str() in deflate_medium.c too. X-Git-Tag: 1.9.9-b1~796^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84eecff6bc746d3f832575735b392331c3d480ff;p=thirdparty%2Fzlib-ng.git Use bulk_insert_str() in deflate_medium.c too. --- diff --git a/deflate_medium.c b/deflate_medium.c index b04abdbbe..7e9c9de18 100644 --- a/deflate_medium.c +++ b/deflate_medium.c @@ -57,6 +57,7 @@ static void insert_match(deflate_state *s, struct match match) { /* matches that are not long enough we need to emit as litterals */ if (match.match_length < MIN_MATCH) { +#ifdef NOT_TWEAK_COMPILER while (match.match_length) { match.strstart++; match.match_length--; @@ -67,6 +68,17 @@ static void insert_match(deflate_state *s, struct match match) { } } } +#else + match.strstart++; + match.match_length--; + if (match.match_length > 0) { + if (match.strstart >= match.orgstart) { + bulk_insert_str(s, match.strstart, match.match_length); + } + match.strstart += match.match_length; + match.match_length = 0; + } +#endif return; } @@ -75,16 +87,24 @@ 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 { - match.strstart++; - if (likely(match.strstart >= match.orgstart)) { - insert_string(s, match.strstart); - } + if (likely(match.strstart >= match.orgstart)) { + 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); - match.strstart++; +#else + if (likely(match.strstart >= match.orgstart)) { + bulk_insert_str(s, match.strstart, match.match_length); + } + match.strstart += match.match_length; + match.match_length = 0; +#endif } else { match.strstart += match.match_length; match.match_length = 0;