]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Don't assign C versions of compare258 and longest_match if we don't use them.
authorNathan Moinvaziri <nathan@nathanm.com>
Fri, 31 Dec 2021 16:15:34 +0000 (08:15 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 8 Jan 2022 12:56:43 +0000 (13:56 +0100)
functable.c

index da21a808b20d726f60e289915833fab7b7784773..c2e23f55e724ab2596154a9aeeafb15e5dc49bb0 100644 (file)
@@ -555,8 +555,6 @@ Z_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t
 
 Z_INTERNAL uint32_t compare258_stub(const unsigned char *src0, const unsigned char *src1) {
 
-    functable.compare258 = &compare258_c;
-
 #ifdef UNALIGNED_OK
 #  if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL)
     functable.compare258 = &compare258_unaligned_64;
@@ -573,6 +571,8 @@ Z_INTERNAL uint32_t compare258_stub(const unsigned char *src0, const unsigned ch
     if (x86_cpu_has_avx2)
         functable.compare258 = &compare258_unaligned_avx2;
 #  endif
+#else
+    functable.compare258 = &compare258_c;
 #endif
 
     return functable.compare258(src0, src1);
@@ -580,8 +580,6 @@ Z_INTERNAL uint32_t compare258_stub(const unsigned char *src0, const unsigned ch
 
 Z_INTERNAL uint32_t longest_match_stub(deflate_state *const s, Pos cur_match) {
 
-    functable.longest_match = &longest_match_c;
-
 #ifdef UNALIGNED_OK
 #  if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL)
     functable.longest_match = &longest_match_unaligned_64;
@@ -598,6 +596,8 @@ Z_INTERNAL uint32_t longest_match_stub(deflate_state *const s, Pos cur_match) {
     if (x86_cpu_has_avx2)
         functable.longest_match = &longest_match_unaligned_avx2;
 #  endif
+#else
+    functable.longest_match = &longest_match_c;
 #endif
 
     return functable.longest_match(s, cur_match);
@@ -605,8 +605,6 @@ Z_INTERNAL uint32_t longest_match_stub(deflate_state *const s, Pos cur_match) {
 
 Z_INTERNAL uint32_t longest_match_slow_stub(deflate_state *const s, Pos cur_match) {
 
-    functable.longest_match_slow = &longest_match_slow_c;
-
 #ifdef UNALIGNED_OK
 #  if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL)
     functable.longest_match_slow = &longest_match_slow_unaligned_64;
@@ -623,6 +621,8 @@ Z_INTERNAL uint32_t longest_match_slow_stub(deflate_state *const s, Pos cur_matc
     if (x86_cpu_has_avx2)
         functable.longest_match_slow = &longest_match_slow_unaligned_avx2;
 #  endif
+#else
+    functable.longest_match_slow = &longest_match_slow_c;
 #endif
 
     return functable.longest_match_slow(s, cur_match);