diff options
| author | Nathan Moinvaziri <nathan@nathanm.com> | 2020-08-18 17:45:48 -0700 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2020-08-20 21:49:17 +0200 |
| commit | dd753715a99e1ec258fc38b4761071e199495ede (patch) | |
| tree | bfc7b311ce4c7f637e7ab9bef18fa87c3c32af00 | |
| parent | da1ab79e1d9608d669297a9964644a6a39526be1 (diff) | |
| download | Project-Tick-dd753715a99e1ec258fc38b4761071e199495ede.tar.gz Project-Tick-dd753715a99e1ec258fc38b4761071e199495ede.zip | |
Move zero check for insert_string count to fill_window since it is the only place where count is ever passed as zero.
| -rw-r--r-- | deflate.c | 6 | ||||
| -rw-r--r-- | insert_string_tpl.h | 14 |
2 files changed, 8 insertions, 12 deletions
@@ -1316,8 +1316,10 @@ void ZLIB_INTERNAL fill_window(deflate_state *s) { } else { count = s->insert; } - functable.insert_string(s, str, count); - s->insert -= count; + if (count > 0) { + functable.insert_string(s, str, count); + s->insert -= count; + } #endif } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, diff --git a/insert_string_tpl.h b/insert_string_tpl.h index 127a7ca8d1..4900010cac 100644 --- a/insert_string_tpl.h +++ b/insert_string_tpl.h @@ -61,17 +61,11 @@ ZLIB_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, const uint32_t str * (except for the last MIN_MATCH-1 bytes of the input file). */ ZLIB_INTERNAL Pos INSERT_STRING(deflate_state *const s, const uint32_t str, uint32_t count) { - Pos idx, ret; - uint8_t *strstart, *strend; - - if (UNLIKELY(count == 0)) { - return s->prev[str & s->w_mask]; - } - - strstart = s->window + str; - strend = strstart + count - 1; /* last position */ + Pos idx, ret = 0; + uint8_t *strstart = s->window + str; + uint8_t *strend = strstart + count - 1; /* last position */ - for (ret = 0, idx = str; strstart <= strend; idx++, strstart++) { + for (idx = str; strstart <= strend; idx++, strstart++) { uint32_t val, hm, h = 0; #ifdef UNALIGNED_OK |
