]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Let all x86 and x86_64 archs use the new UPDATE_HASH implementation,
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Sat, 18 Feb 2017 18:26:52 +0000 (19:26 +0100)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Sat, 18 Feb 2017 18:26:52 +0000 (19:26 +0100)
this improves compression performance and can often provide slightly
better compression.

deflate.c
deflate.h

index ef286450ab60a4bb6fe58fe6c16dcbeb48249e52..710f19faa822e645c307c3eab3bfe41b2061ed98 100644 (file)
--- 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;
index c8381cbfbca5c280e1f30fc25c5013150bb00d83..acd342d102d392bc09f9585a6c56411a212e46f3 100644 (file)
--- 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) \