aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/check/crc32_fast.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2024-01-10 18:23:31 +0200
committerLasse Collin <lasse.collin@tukaani.org>2024-01-11 14:29:42 +0200
commit66f080e8016129576536482ac377e2ecac7a2b90 (patch)
treea362593e7dafb49c5d6af1f64a72f4a1168fbc45 /src/liblzma/check/crc32_fast.c
parentliblzma: Fix a comment in crc_common.h. (diff)
downloadxz-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 'src/liblzma/check/crc32_fast.c')
-rw-r--r--src/liblzma/check/crc32_fast.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/liblzma/check/crc32_fast.c b/src/liblzma/check/crc32_fast.c
index 6982836a..7157e2f4 100644
--- a/src/liblzma/check/crc32_fast.c
+++ b/src/liblzma/check/crc32_fast.c
@@ -15,7 +15,7 @@
#include "check.h"
#include "crc_common.h"
-#ifdef CRC_CLMUL
+#ifdef CRC_X86_CLMUL
# define BUILDING_CRC32_CLMUL
# include "crc_x86_clmul.h"
#endif
@@ -87,7 +87,7 @@ crc32_generic(const uint8_t *buf, size_t size, uint32_t crc)
#endif
-#if defined(CRC_GENERIC) && defined(CRC_CLMUL)
+#if defined(CRC_GENERIC) && defined(CRC_ARCH_OPTIMIZED)
//////////////////////////
// Function dispatching //
@@ -137,7 +137,8 @@ typedef uint32_t (*crc32_func_type)(
static crc32_func_type
crc32_resolve(void)
{
- return is_clmul_supported() ? &crc32_clmul : &crc32_generic;
+ return is_arch_extension_supported()
+ ? &crc32_arch_optimized : &crc32_generic;
}
#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(__clang__)
@@ -193,7 +194,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
extern LZMA_API(uint32_t)
lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
{
-#if defined(CRC_GENERIC) && defined(CRC_CLMUL)
+#if defined(CRC_GENERIC) && defined(CRC_ARCH_OPTIMIZED)
// If CLMUL is available, it is the best for non-tiny inputs,
// being over twice as fast as the generic slice-by-four version.
// However, for size <= 16 it's different. In the extreme case
@@ -225,8 +226,8 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
*/
return crc32_func(buf, size, crc);
-#elif defined(CRC_CLMUL)
- return crc32_clmul(buf, size, crc);
+#elif defined(CRC_ARCH_OPTIMIZED)
+ return crc32_arch_optimized(buf, size, crc);
#else
return crc32_generic(buf, size, crc);