diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2024-01-10 18:23:31 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2024-01-11 14:29:42 +0200 |
commit | 66f080e8016129576536482ac377e2ecac7a2b90 (patch) | |
tree | a362593e7dafb49c5d6af1f64a72f4a1168fbc45 /src/liblzma/check/crc64_fast.c | |
parent | liblzma: Fix a comment in crc_common.h. (diff) | |
download | xz-66f080e8016129576536482ac377e2ecac7a2b90.tar.xz |
liblzma: Rename arch-specific CRC functions and macros.
CRC_CLMUL was split to CRC_ARCH_OPTIMIZED and CRC_X86_CLMUL.
CRC_ARCH_OPTIMIZED is defined when an arch-optimized version is used.
Currently the x86 CLMUL implementations are the only arch-optimized
versions, and these also use the CRC_x86_CLMUL macro to tell when
crc_x86_clmul.h needs to be included.
is_clmul_supported() was renamed to is_arch_extension_supported().
crc32_clmul() and crc64_clmul() were renamed to
crc32_arch_optimized() and crc64_arch_optimized().
This way the names make sense with arch-specific non-CLMUL
implementations as well.
Diffstat (limited to '')
-rw-r--r-- | src/liblzma/check/crc64_fast.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/liblzma/check/crc64_fast.c b/src/liblzma/check/crc64_fast.c index 46b5c646..4edca1a2 100644 --- a/src/liblzma/check/crc64_fast.c +++ b/src/liblzma/check/crc64_fast.c @@ -14,7 +14,7 @@ #include "check.h" #include "crc_common.h" -#ifdef CRC_CLMUL +#ifdef CRC_X86_CLMUL # define BUILDING_CRC64_CLMUL # include "crc_x86_clmul.h" #endif @@ -82,7 +82,7 @@ crc64_generic(const uint8_t *buf, size_t size, uint64_t crc) #endif -#if defined(CRC_GENERIC) && defined(CRC_CLMUL) +#if defined(CRC_GENERIC) && defined(CRC_ARCH_OPTIMIZED) ////////////////////////// // Function dispatching // @@ -102,7 +102,8 @@ typedef uint64_t (*crc64_func_type)( static crc64_func_type crc64_resolve(void) { - return is_clmul_supported() ? &crc64_clmul : &crc64_generic; + return is_arch_extension_supported() + ? &crc64_arch_optimized : &crc64_generic; } #if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(__clang__) @@ -150,7 +151,7 @@ lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) extern LZMA_API(uint64_t) lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) { -#if defined(CRC_GENERIC) && defined(CRC_CLMUL) +#if defined(CRC_GENERIC) && defined(CRC_ARCH_OPTIMIZED) #ifdef CRC_USE_GENERIC_FOR_SMALL_INPUTS if (size <= 16) @@ -158,14 +159,14 @@ lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) #endif return crc64_func(buf, size, crc); -#elif defined(CRC_CLMUL) +#elif defined(CRC_ARCH_OPTIMIZED) // If CLMUL is used unconditionally without runtime CPU detection // then omitting the generic version and its 8 KiB lookup table // makes the library smaller. // // FIXME: Lookup table isn't currently omitted on 32-bit x86, // see crc64_table.c. - return crc64_clmul(buf, size, crc); + return crc64_arch_optimized(buf, size, crc); #else return crc64_generic(buf, size, crc); |