s->hash_size = 1 << s->hash_bits;
s->hash_mask = s->hash_size - 1;
-#if !defined(__x86_64__) && !defined(_M_X64) && !defined(__i386) && !defined(_M_IX86)
- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
-#endif
#ifdef X86_PCLMULQDQ_CRC
window_padding = 8;
s->match_length = s->prev_length = MIN_MATCH-1;
s->match_available = 0;
s->match_start = 0;
- s->ins_h = 0;
}
#ifdef ZLIB_DEBUG
/* Initialize the hash value now that we have some input: */
if (s->lookahead + s->insert >= MIN_MATCH) {
unsigned int str = s->strstart - s->insert;
- s->ins_h = s->window[str];
if (str >= 1)
functable.quick_insert_string(s, str + 2 - MIN_MATCH);
#if MIN_MATCH != 3
Pos *head; /* Heads of the hash chains or NIL. */
- unsigned int ins_h; /* hash index of string to be inserted */
unsigned int hash_size; /* number of elements in hash table */
unsigned int hash_bits; /* log2(hash_size) */
unsigned int hash_mask; /* hash_size-1 */
-#if !defined(__x86_64__) && !defined(_M_X64) && !defined(__i386) && !defined(_M_IX86)
- unsigned int hash_shift;
-#endif
- /* Number of bits by which ins_h must be shifted at each input
- * step. It must be such that after MIN_MATCH steps, the oldest
- * byte no longer takes part in the hash key, that is:
- * hash_shift * MIN_MATCH >= hash_bits
- */
-
long block_start;
/* Window position at the beginning of the current output block. Gets
* negative when the window is moved backwards.
} else {
s->strstart += s->match_length;
s->match_length = 0;
- s->ins_h = s->window[s->strstart];
#if MIN_MATCH != 3
functable.insert_string(s, s->strstart + 2 - MIN_MATCH, MIN_MATCH - 2);
#else
} else {
match.strstart += match.match_length;
match.match_length = 0;
- s->ins_h = s->window[match.strstart];
if (match.strstart >= (MIN_MATCH - 2))
#if MIN_MATCH != 3
functable.insert_string(s, match.strstart + 2 - MIN_MATCH, MIN_MATCH - 2);
* previous key instead of complete recalculation each time.
*/
-#if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86)
-# define UPDATE_HASH(s, h, val) \
- h = (3483 * ((val) & 0xff) +\
- 23081 * (((val) >> 8) & 0xff) +\
- 6954 * (((val) >> 16) & 0xff) +\
- 20947 * (((val) >> 24) & 0xff));
-#else
-# define UPDATE_HASH(s, h, val)\
- h = (s->ins_h = ((s->ins_h << s->hash_shift) ^ ((val) >> ((MIN_MATCH - 1) * 8))) & s->hash_mask)
-#endif
+#define UPDATE_HASH(s, h, val) \
+ h = ((val * 2654435761U) >> (32 - s->hash_bits));
#define INSERT_STRING insert_string_c
#define QUICK_INSERT_STRING quick_insert_string_c