mirror of
https://github.com/GerbilSoft/zlib-ng.git
synced 2025-06-19 03:55:39 -04:00
Remove deflate_state parameter from update_hash functions.
This commit is contained in:
parent
7cca3e6fd7
commit
a090529ece
@ -25,7 +25,7 @@ uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len);
|
|||||||
|
|
||||||
void insert_string_acle(deflate_state *const s, const uint32_t str, uint32_t count);
|
void insert_string_acle(deflate_state *const s, const uint32_t str, uint32_t count);
|
||||||
Pos quick_insert_string_acle(deflate_state *const s, const uint32_t str);
|
Pos quick_insert_string_acle(deflate_state *const s, const uint32_t str);
|
||||||
uint32_t update_hash_acle(deflate_state *const s, uint32_t h, uint32_t val);
|
uint32_t update_hash_acle(uint32_t h, uint32_t val);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARM_SIMD
|
#ifdef ARM_SIMD
|
||||||
|
@ -29,7 +29,7 @@ void inflate_fast_ssse3(PREFIX3(stream) *strm, uint32_t start);
|
|||||||
uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len);
|
uint32_t adler32_fold_copy_sse42(uint32_t adler, uint8_t *dst, const uint8_t *src, size_t len);
|
||||||
void insert_string_sse42(deflate_state *const s, const uint32_t str, uint32_t count);
|
void insert_string_sse42(deflate_state *const s, const uint32_t str, uint32_t count);
|
||||||
Pos quick_insert_string_sse42(deflate_state *const s, const uint32_t str);
|
Pos quick_insert_string_sse42(deflate_state *const s, const uint32_t str);
|
||||||
uint32_t update_hash_sse42(deflate_state *const s, uint32_t h, uint32_t val);
|
uint32_t update_hash_sse42(uint32_t h, uint32_t val);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef X86_AVX2
|
#ifdef X86_AVX2
|
||||||
|
@ -120,7 +120,7 @@ static void lm_set_level (deflate_state *s, int level);
|
|||||||
static void lm_init (deflate_state *s);
|
static void lm_init (deflate_state *s);
|
||||||
Z_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
|
Z_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
|
||||||
|
|
||||||
extern uint32_t update_hash_roll (deflate_state *const s, uint32_t h, uint32_t val);
|
extern uint32_t update_hash_roll (uint32_t h, uint32_t val);
|
||||||
extern void insert_string_roll (deflate_state *const s, uint32_t str, uint32_t count);
|
extern void insert_string_roll (deflate_state *const s, uint32_t str, uint32_t count);
|
||||||
extern Pos quick_insert_string_roll(deflate_state *const s, uint32_t str);
|
extern Pos quick_insert_string_roll(deflate_state *const s, uint32_t str);
|
||||||
|
|
||||||
@ -1236,7 +1236,7 @@ void Z_INTERNAL PREFIX(fill_window)(deflate_state *s) {
|
|||||||
if (s->lookahead + s->insert >= STD_MIN_MATCH) {
|
if (s->lookahead + s->insert >= STD_MIN_MATCH) {
|
||||||
unsigned int str = s->strstart - s->insert;
|
unsigned int str = s->strstart - s->insert;
|
||||||
if (UNLIKELY(s->max_chain_length > 1024)) {
|
if (UNLIKELY(s->max_chain_length > 1024)) {
|
||||||
s->ins_h = s->update_hash(s, s->window[str], s->window[str+1]);
|
s->ins_h = s->update_hash(s->window[str], s->window[str+1]);
|
||||||
} else if (str >= 1) {
|
} else if (str >= 1) {
|
||||||
s->quick_insert_string(s, str + 2 - STD_MIN_MATCH);
|
s->quick_insert_string(s, str + 2 - STD_MIN_MATCH);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ typedef uint16_t Pos;
|
|||||||
/* Type definitions for hash callbacks */
|
/* Type definitions for hash callbacks */
|
||||||
typedef struct internal_state deflate_state;
|
typedef struct internal_state deflate_state;
|
||||||
|
|
||||||
typedef uint32_t (* update_hash_cb) (deflate_state *const s, uint32_t h, uint32_t val);
|
typedef uint32_t (* update_hash_cb) (uint32_t h, uint32_t val);
|
||||||
typedef void (* insert_string_cb) (deflate_state *const s, uint32_t str, uint32_t count);
|
typedef void (* insert_string_cb) (deflate_state *const s, uint32_t str, uint32_t count);
|
||||||
typedef Pos (* quick_insert_string_cb)(deflate_state *const s, uint32_t str);
|
typedef Pos (* quick_insert_string_cb)(deflate_state *const s, uint32_t str);
|
||||||
|
|
||||||
|
@ -352,9 +352,9 @@ static void slide_hash_stub(deflate_state* s) {
|
|||||||
functable.slide_hash(s);
|
functable.slide_hash(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t update_hash_stub(deflate_state* const s, uint32_t h, uint32_t val) {
|
static uint32_t update_hash_stub(uint32_t h, uint32_t val) {
|
||||||
init_functable();
|
init_functable();
|
||||||
return functable.update_hash(s, h, val);
|
return functable.update_hash(h, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* functable init */
|
/* functable init */
|
||||||
|
@ -27,7 +27,7 @@ struct functable_s {
|
|||||||
uint32_t (* longest_match_slow) (deflate_state *const s, Pos cur_match);
|
uint32_t (* longest_match_slow) (deflate_state *const s, Pos cur_match);
|
||||||
Pos (* quick_insert_string)(deflate_state *const s, uint32_t str);
|
Pos (* quick_insert_string)(deflate_state *const s, uint32_t str);
|
||||||
void (* slide_hash) (deflate_state *s);
|
void (* slide_hash) (deflate_state *s);
|
||||||
uint32_t (* update_hash) (deflate_state *const s, uint32_t h, uint32_t val);
|
uint32_t (* update_hash) (uint32_t h, uint32_t val);
|
||||||
};
|
};
|
||||||
|
|
||||||
Z_INTERNAL extern struct functable_s functable;
|
Z_INTERNAL extern struct functable_s functable;
|
||||||
|
@ -47,8 +47,7 @@
|
|||||||
* input characters, so that a running hash key can be computed from the
|
* input characters, so that a running hash key can be computed from the
|
||||||
* previous key instead of complete recalculation each time.
|
* previous key instead of complete recalculation each time.
|
||||||
*/
|
*/
|
||||||
Z_INTERNAL uint32_t UPDATE_HASH(deflate_state *const s, uint32_t h, uint32_t val) {
|
Z_INTERNAL uint32_t UPDATE_HASH(uint32_t h, uint32_t val) {
|
||||||
(void)s;
|
|
||||||
HASH_CALC(s, h, val);
|
HASH_CALC(s, h, val);
|
||||||
return h & HASH_CALC_MASK;
|
return h & HASH_CALC_MASK;
|
||||||
}
|
}
|
||||||
|
12
match_tpl.h
12
match_tpl.h
@ -102,11 +102,11 @@ Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
|
|||||||
* to cur_match). We cannot use s->prev[strstart+1,...] immediately, because
|
* to cur_match). We cannot use s->prev[strstart+1,...] immediately, because
|
||||||
* these strings are not yet inserted into the hash table.
|
* these strings are not yet inserted into the hash table.
|
||||||
*/
|
*/
|
||||||
hash = s->update_hash(s, 0, scan[1]);
|
hash = s->update_hash(0, scan[1]);
|
||||||
hash = s->update_hash(s, hash, scan[2]);
|
hash = s->update_hash(hash, scan[2]);
|
||||||
|
|
||||||
for (i = 3; i <= best_len; i++) {
|
for (i = 3; i <= best_len; i++) {
|
||||||
hash = s->update_hash(s, hash, scan[i]);
|
hash = s->update_hash(hash, scan[i]);
|
||||||
|
|
||||||
/* If we're starting with best_len >= 3, we can use offset search. */
|
/* If we're starting with best_len >= 3, we can use offset search. */
|
||||||
pos = s->head[hash];
|
pos = s->head[hash];
|
||||||
@ -236,9 +236,9 @@ Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
|
|||||||
*/
|
*/
|
||||||
scan_endstr = scan + len - (STD_MIN_MATCH+1);
|
scan_endstr = scan + len - (STD_MIN_MATCH+1);
|
||||||
|
|
||||||
hash = s->update_hash(s, 0, scan_endstr[0]);
|
hash = s->update_hash(0, scan_endstr[0]);
|
||||||
hash = s->update_hash(s, hash, scan_endstr[1]);
|
hash = s->update_hash(hash, scan_endstr[1]);
|
||||||
hash = s->update_hash(s, hash, scan_endstr[2]);
|
hash = s->update_hash(hash, scan_endstr[2]);
|
||||||
|
|
||||||
pos = s->head[hash];
|
pos = s->head[hash];
|
||||||
if (pos < cur_match) {
|
if (pos < cur_match) {
|
||||||
|
Loading…
Reference in New Issue
Block a user