blob: 4e4c628bfbf5cd608aa619319d095ee16fa71871 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* insert_string_c -- insert_string variant for c
*
* Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
*/
#include "zbuild.h"
#include "deflate.h"
/* ===========================================================================
* Update a hash value with the given input byte
* IN assertion: all calls to to UPDATE_HASH are made with consecutive
* input characters, so that a running hash key can be computed from the
* 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) \
do {\
if (s->level < TRIGGER_LEVEL)\
h = (3483 * ((val) & 0xff) +\
23081* (((val) >> 8) & 0xff) +\
6954 * (((val) >> 16) & 0xff) +\
20947* (((val) >> 24) & 0xff));\
else\
h = (25881* (((val)) & 0xff) +\
24674* (((val) >> 8) & 0xff) +\
25811* (((val) >> 16) & 0xff));\
} while (0)
#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 INSERT_STRING insert_string_c
#define QUICK_INSERT_STRING quick_insert_string_c
#include "insert_string_tpl.h"
|