From 8c0f9376f58c0696d5d6719705164d35542dd891 Mon Sep 17 00:00:00 2001 From: Jia Tan Date: Sat, 14 Oct 2023 12:17:57 +0800 Subject: liblzma: Create crc_clmul.c. Both crc32_clmul() and crc64_clmul() are now exported from crc32_clmul.c as lzma_crc32_clmul() and lzma_crc64_clmul(). This ensures that is_clmul_supported() (now lzma_is_clmul_supported()) is not duplicated between crc32_fast.c and crc64_fast.c. Also, it encapsulates the complexity of the CLMUL implementations into a single file and reduces the complexity of crc32_fast.c and crc64_fast.c. Before, CLMUL code was present in crc32_fast.c, crc64_fast.c, and crc_common.h. During the conversion, various cleanups were applied to code (thanks to Lasse Collin) including: - Require using semicolons with MASK_/L/H/LH macros. - Variable typing and const handling improvements. - Improvements to comments. - Fixes to the pragmas used. - Removed unneeded variables. - Whitespace improvements. - Fixed CRC_USE_GENERIC_FOR_SMALL_INPUTS handling. - Silenced warnings and removed the need for some #pragmas --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ecbb7b2d..6e3cd6f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -845,7 +845,11 @@ if(HAVE_IMMINTRIN_H) int main(void) { return 0; } " HAVE_USABLE_CLMUL) - tuklib_add_definition_if(liblzma HAVE_USABLE_CLMUL) + + if(HAVE_USABLE_CLMUL) + target_sources(liblzma PRIVATE src/liblzma/check/crc_clmul.c) + target_compile_definitions(liblzma PRIVATE HAVE_USABLE_CLMUL) + endif() endif() # Support -fvisiblity=hidden when building shared liblzma. -- cgit v1.2.3