diff options
author | Nathan Moinvaziri <nathan@nathanm.com> | 2020-01-17 19:04:20 -0800 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2020-04-30 10:01:46 +0200 |
commit | 69bbb0d823771bc84ed1ba96381a91e06847c428 (patch) | |
tree | b9f3732d273f20d898f03c5773635c7af6966aea /arch/arm/insert_string_acle.c | |
parent | 42aa81beafa2ea14cd780a9acf3359a0a09ca44b (diff) |
Standardize insert_string functionality across architectures. Added unaligned conditionally compiled code for insert_string and quick_insert_string. Unify sse42 crc32 assembly between insert_string and quick_insert_string. Modified quick_insert_string to work across architectures.
Diffstat (limited to 'arch/arm/insert_string_acle.c')
-rw-r--r-- | arch/arm/insert_string_acle.c | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/arch/arm/insert_string_acle.c b/arch/arm/insert_string_acle.c index b6ddc07..28345d8 100644 --- a/arch/arm/insert_string_acle.c +++ b/arch/arm/insert_string_acle.c @@ -10,44 +10,11 @@ #include "../../zbuild.h" #include "../../deflate.h" -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -Pos insert_string_acle(deflate_state *const s, const Pos str, unsigned int count) { - Pos p, lp, ret; - - if (UNLIKELY(count == 0)) { - return s->prev[str & s->w_mask]; - } - - ret = 0; - lp = str + count - 1; /* last position */ - - for (p = str; p <= lp; p++) { - uint32_t val, h, hm; - memcpy(&val, &s->window[p], sizeof(val)); - - if (s->level >= TRIGGER_LEVEL) - val &= 0xFFFFFF; +#define UPDATE_HASH(s, h, val) \ + h = __crc32w(0, val) - h = __crc32w(0, val); - hm = h & s->hash_mask; +#define INSERT_STRING insert_string_acle +#define QUICK_INSERT_STRING quick_insert_string_acle - Pos head = s->head[hm]; - if (head != p) { - s->prev[p & s->w_mask] = head; - s->head[hm] = p; - if (p == lp) - ret = head; - } else if (p == lp) { - ret = p; - } - } - return ret; -} +#include "../../insert_string_tpl.h" #endif |