aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/check/crc32_table.c
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2024-01-22 21:36:09 +0800
committerJia Tan <jiat0218@gmail.com>2024-02-01 20:09:11 +0800
commit1940f0ec28f08c0ac72c1413d9706fb82eabe6ad (patch)
tree2df2dc8e2e9ea84e725b6b67b906f668c70eed64 /src/liblzma/check/crc32_table.c
parentliblzma: Rename crc32_aarch64.h to crc32_arm64.h. (diff)
downloadxz-1940f0ec28f08c0ac72c1413d9706fb82eabe6ad.tar.xz
liblzma: Omit CRC tables when not needed with ARM64 optimizations.
This is similar to the existing x86-64 CLMUL conditions to omit the tables. They were slightly refactored to improve readability.
Diffstat (limited to '')
-rw-r--r--src/liblzma/check/crc32_table.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/liblzma/check/crc32_table.c b/src/liblzma/check/crc32_table.c
index e53b63c9..41a80dcb 100644
--- a/src/liblzma/check/crc32_table.c
+++ b/src/liblzma/check/crc32_table.c
@@ -13,11 +13,23 @@
#include "common.h"
-// FIXME: Compared to crc32_fast.c this has to check for __x86_64__ too
+// FIXME: Compared to crc_common.h this has to check for __x86_64__ too
// so that in 32-bit builds crc32_x86.S won't break due to a missing table.
-#if !defined(HAVE_ENCODERS) && ((defined(__x86_64__) && defined(__SSSE3__) \
+#if (defined(__x86_64__) && defined(__SSSE3__) \
&& defined(__SSE4_1__) && defined(__PCLMUL__)) \
- || (defined(__e2k__) && __iset__ >= 6))
+ || (defined(__e2k__) && __iset__ >= 6)
+# define X86_CLMUL_NO_TABLE 1
+#endif
+
+#if defined(HAVE_ARM64_CRC32) \
+ && !defined(WORDS_BIGENDIAN) \
+ && defined(__ARM_FEATURE_CRC32)
+# define ARM64_CRC32_NO_TABLE 1
+#endif
+
+
+#if !defined(HAVE_ENCODERS) && (defined(X86_CLMUL_NO_TABLE) \
+ || defined(ARM64_CRC32_NO_TABLE_))
// No table needed. Use a typedef to avoid an empty translation unit.
typedef void lzma_crc32_dummy;