]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Move crc32_fold_s struct into x86 implementation.
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 14 Dec 2025 18:32:02 +0000 (10:32 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sun, 28 Dec 2025 13:07:03 +0000 (14:07 +0100)
arch/s390/dfltcc_deflate.c
arch/x86/crc32_fold_pclmulqdq_tpl.h
crc32.h
deflate.h
inflate.h

index 2eaf8e1cfa4c93097c2ce2e159e69231382eada8..f94950033d0d35a39ac78540997d5c08cceb448d 100644 (file)
@@ -228,7 +228,7 @@ again:
     if (state->wrap == 1)
         param->cv = strm->adler;
     else if (state->wrap == 2)
-        param->cv = ZSWAP32(state->crc_fold.value);
+        param->cv = ZSWAP32(strm->adler);
 
     /* When opening a block, choose a Huffman-Table Type */
     if (!param->bcf) {
@@ -262,7 +262,7 @@ again:
     if (state->wrap == 1)
         strm->adler = param->cv;
     else if (state->wrap == 2)
-        state->crc_fold.value = ZSWAP32(param->cv);
+        strm->adler = ZSWAP32(param->cv);
 
     /* Unmask the input data */
     strm->avail_in += masked_avail_in;
index e7e57c546a86f18e5033da0b645206eb9eee6920..b36a9f04075e30025c7fd5b3d807e71fdcee546a 100644 (file)
 #include "crc32_braid_tbl.h"
 #include "x86_intrins.h"
 
+/* sizeof(__m128i) * (4 folds) */
+#define CRC32_FOLD_BUFFER_SIZE (16 * 4)
+
+typedef struct crc32_fold_s {
+    uint8_t fold[CRC32_FOLD_BUFFER_SIZE];
+    uint32_t value;
+} crc32_fold;
+
+
 static const unsigned ALIGNED_(16) crc_k[] = {
     0xccaa009e, 0x00000000, /* rk1 */
     0x751997d0, 0x00000001, /* rk2 */
diff --git a/crc32.h b/crc32.h
index d41af8f01f6fcdd11f9466441bbb3d86fa24d5ef..e205777598fd13288b5afd331141c6a6b23d8e64 100644 (file)
--- a/crc32.h
+++ b/crc32.h
@@ -5,9 +5,6 @@
 #ifndef CRC32_H_
 #define CRC32_H_
 
-/* sizeof(__m128i) * (4 folds) */
-#define CRC32_FOLD_BUFFER_SIZE (16 * 4)
-
 /* Size thresholds for Chorba algorithm variants */
 #define CHORBA_LARGE_THRESHOLD (sizeof(z_word_t) * 64 * 1024)
 #define CHORBA_MEDIUM_UPPER_THRESHOLD 32768
@@ -19,9 +16,4 @@
 #  define CHORBA_SMALL_THRESHOLD 80
 #endif
 
-typedef struct crc32_fold_s {
-    uint8_t fold[CRC32_FOLD_BUFFER_SIZE];
-    uint32_t value;
-} crc32_fold;
-
 #endif
index 95c76f1e29133a9a9fd7ce642b89bff726ebb84a..4957b940dcb60f0951fede0f37663e3737a7705d 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -240,7 +240,7 @@ struct ALIGNED_(64) internal_state {
     int32_t padding1[1];
 
                 /* Cacheline 3 */
-    struct crc32_fold_s ALIGNED_(16) crc_fold;
+    uint8_t ALIGNED_(16) padding4[68];
 
                 /* used by trees.c: */
     /* Didn't use ct_data typedef below to suppress compiler warning */
index 1427e90857f429e18334f363a92207bc30f4cf8d..1bc845c7506dd0fe0cb8d55344b6a18bd5af686d 100644 (file)
--- a/inflate.h
+++ b/inflate.h
@@ -142,7 +142,7 @@ struct ALIGNED_(64) inflate_state {
 #if defined(_M_IX86) || defined(_M_ARM)
     uint32_t padding[1];
 #endif
-    struct crc32_fold_s ALIGNED_(16) crc_fold;
+    uint8_t ALIGNED_(16) padding4[68];
 
     uint16_t lens[320];         /* temporary storage for code lengths */
     uint16_t work[288];         /* work area for code table building */