From: Hans Kristian Rosbach Date: Sat, 18 Feb 2017 18:26:52 +0000 (+0100) Subject: Let all x86 and x86_64 archs use the new UPDATE_HASH implementation, X-Git-Tag: 1.9.9-b1~676 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eea078bd3b14eb1546c464c4798ace5f7adfb934;p=thirdparty%2Fzlib-ng.git Let all x86 and x86_64 archs use the new UPDATE_HASH implementation, this improves compression performance and can often provide slightly better compression. --- diff --git a/deflate.c b/deflate.c index ef286450a..710f19faa 100644 --- a/deflate.c +++ b/deflate.c @@ -301,7 +301,9 @@ int ZEXPORT deflateInit2_(z_stream *strm, int level, int method, int windowBits, s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; +#if !defined(__x86_64) && !defined(__i386_) s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); +#endif #ifdef X86_PCLMULQDQ_CRC window_padding = 8; diff --git a/deflate.h b/deflate.h index c8381cbfb..acd342d10 100644 --- a/deflate.h +++ b/deflate.h @@ -153,7 +153,9 @@ typedef struct internal_state { unsigned int hash_bits; /* log2(hash_size) */ unsigned int hash_mask; /* hash_size-1 */ + #if !defined(__x86_64) && !defined(__i386_) 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: @@ -402,7 +404,7 @@ void ZLIB_INTERNAL bi_windup(deflate_state *s); #define TRIGGER_LEVEL 5 #endif -#ifdef X86_SSE4_2_CRC_HASH +#if defined(__x86_64) || defined(__i386_) #define UPDATE_HASH(s, h, i) \ do {\ if (s->level < TRIGGER_LEVEL) \