diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2024-04-10 23:20:02 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2024-04-10 23:33:17 +0300 |
commit | 6286c1900c2d2ca33d9b1b397122c7bcdb9a4d59 (patch) | |
tree | 26922ba2e649fd147c11b34c1de4929303aec7e5 /src | |
parent | liblzma: ARM64 CRC: Fix omission of CRC32 table (diff) | |
download | xz-6286c1900c2d2ca33d9b1b397122c7bcdb9a4d59.tar.xz |
liblzma: CRC: Simplify table omission macros
A macro is useful to prevent a single #if directive from
getting too ugly but only one macro is needed for all archs.
Diffstat (limited to 'src')
-rw-r--r-- | src/liblzma/check/crc32_table.c | 10 | ||||
-rw-r--r-- | src/liblzma/check/crc64_table.c | 4 | ||||
-rw-r--r-- | src/liblzma/check/crc_common.h | 5 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/liblzma/check/crc32_table.c b/src/liblzma/check/crc32_table.c index a78a629e..c141cefe 100644 --- a/src/liblzma/check/crc32_table.c +++ b/src/liblzma/check/crc32_table.c @@ -17,18 +17,16 @@ #if defined(HAVE_USABLE_CLMUL) && ((defined(__x86_64__) && defined(__SSSE3__) \ && defined(__SSE4_1__) && defined(__PCLMUL__)) \ || (defined(__e2k__) && __iset__ >= 6)) -# define X86_CLMUL_NO_TABLE 1 -#endif +# define NO_CRC32_TABLE -#if defined(HAVE_ARM64_CRC32) \ +#elif defined(HAVE_ARM64_CRC32) \ && !defined(WORDS_BIGENDIAN) \ && defined(__ARM_FEATURE_CRC32) -# define ARM64_CRC32_NO_TABLE 1 +# define NO_CRC32_TABLE #endif -#if !defined(HAVE_ENCODERS) && (defined(X86_CLMUL_NO_TABLE) \ - || defined(ARM64_CRC32_NO_TABLE)) +#if !defined(HAVE_ENCODERS) && defined(NO_CRC32_TABLE) // No table needed. Use a typedef to avoid an empty translation unit. typedef void lzma_crc32_dummy; diff --git a/src/liblzma/check/crc64_table.c b/src/liblzma/check/crc64_table.c index 6dee387a..78e42759 100644 --- a/src/liblzma/check/crc64_table.c +++ b/src/liblzma/check/crc64_table.c @@ -17,11 +17,11 @@ #if defined(HAVE_USABLE_CLMUL) && ((defined(__x86_64__) && defined(__SSSE3__) \ && defined(__SSE4_1__) && defined(__PCLMUL__)) \ || (defined(__e2k__) && __iset__ >= 6)) -# define X86_CLMUL_NO_TABLE 1 +# define NO_CRC64_TABLE #endif -#ifdef X86_CLMUL_NO_TABLE +#ifdef NO_CRC64_TABLE // No table needed. Use a typedef to avoid an empty translation unit. typedef void lzma_crc64_dummy; diff --git a/src/liblzma/check/crc_common.h b/src/liblzma/check/crc_common.h index a700f03c..63a7b5ce 100644 --- a/src/liblzma/check/crc_common.h +++ b/src/liblzma/check/crc_common.h @@ -74,7 +74,7 @@ // endian machine. // // NOTE: Keep this and the next check in sync with the macro -// ARM64_CRC32_NO_TABLE in crc32_table.c +// NO_CRC32_TABLE in crc32_table.c #if defined(HAVE_ARM64_CRC32) && !defined(WORDS_BIGENDIAN) // Allow ARM64 CRC32 instruction without a runtime check if // __ARM_FEATURE_CRC32 is defined. GCC and Clang only define this if the @@ -94,7 +94,8 @@ // generic version can be omitted. Note that this doesn't work with MSVC // as I don't know how to detect the features here. // -// NOTE: Keep this in sync with the CLMUL_NO_TABLE macro in crc32_table.c. +// NOTE: Keep this in sync with the NO_CRC32_TABLE macro in crc32_table.c +// and NO_CRC64_TABLE in crc64_table.c. # if (defined(__SSSE3__) && defined(__SSE4_1__) && defined(__PCLMUL__)) \ || (defined(__e2k__) && __iset__ >= 6) # define CRC32_ARCH_OPTIMIZED 1 |