Commit 24703fb for zlib
commit 24703fb7a9435ea69acd1660b22cbf3045d403ea
Author: Mark Adler <git@madler.net>
Date: Sun Nov 15 21:09:09 2026 -0800
Use Z_U8 for ARM CRC32 hardware instructions.
Previously that code would depend on W being defined as 8 and
used the z_word_t type in that case. Now it does not depend on
the value of W and uses the Z_U8 type instead, which is always
defined if there is a 64-bit integer type.
diff --git a/crc32.c b/crc32.c
index 3e418e8..19a2f3e 100644
--- a/crc32.c
+++ b/crc32.c
@@ -105,9 +105,9 @@
# endif
#endif
-/* If available, use the ARM processor CRC32 instruction. */
-#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && \
- defined(W) && W == 8
+/* If available, use the ARM processor CRC32 instruction. This works on 64-bit
+ words, and so does not depend on W, the word size for the braids. */
+#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && defined(Z_U8)
# define ARMCRC32
#endif
@@ -507,9 +507,9 @@ const z_crc_t FAR * ZEXPORT get_crc_table(void) {
uLong ZEXPORT crc32_z(uLong crc, const unsigned char FAR *buf, z_size_t len) {
uLong val;
- z_word_t crc1, crc2;
- const z_word_t *word;
- z_word_t val0, val1, val2;
+ Z_U8 crc1, crc2;
+ const Z_U8 *word;
+ Z_U8 val0, val1, val2;
z_size_t last, last2, i;
z_size_t num;
@@ -531,7 +531,7 @@ uLong ZEXPORT crc32_z(uLong crc, const unsigned char FAR *buf, z_size_t len) {
}
/* Prepare to compute the CRC on full 64-bit words word[0..num-1]. */
- word = (z_word_t const *)buf;
+ word = (Z_U8 const *)buf;
num = len >> 3;
len &= 7;