diff options
-rw-r--r-- | src/liblzma/check/crc32_arm64.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/liblzma/check/crc32_arm64.h b/src/liblzma/check/crc32_arm64.h index 6cdb5dab..f9a43155 100644 --- a/src/liblzma/check/crc32_arm64.h +++ b/src/liblzma/check/crc32_arm64.h @@ -11,7 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// - #ifndef LZMA_CRC32_ARM64_H #define LZMA_CRC32_ARM64_H @@ -21,6 +20,8 @@ # include <arm_acle.h> #endif +// If both versions are going to be built, we need runtime detection +// to check if the instructions are supported. #if defined(CRC32_GENERIC) && defined(CRC32_ARCH_OPTIMIZED) # if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO) # include <sys/auxv.h> @@ -36,8 +37,7 @@ // // NOTE: Build systems check for this too, keep them in sync with this. #if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__) -# define crc_attr_target \ - __attribute__((__target__("+crc"))) +# define crc_attr_target __attribute__((__target__("+crc"))) #else # define crc_attr_target #endif @@ -62,7 +62,7 @@ crc32_arch_optimized(const uint8_t *buf, size_t size, uint32_t crc) // ignoring the least significant three bits of size to ensure // we do not process past the bounds of the buffer. This guarantees // that limit is a multiple of 8 and is strictly less than size. - for (const uint8_t *limit = buf + (size & ~((size_t)7)); + for (const uint8_t *limit = buf + (size & ~(size_t)7); buf < limit; buf += 8) crc = __crc32d(crc, aligned_read64le(buf)); @@ -98,7 +98,7 @@ is_arch_extension_supported(void) // The sysctlbyname() function requires a string identifier for the // CPU feature it tests. The Apple documentation lists the string // "hw.optional.armv8_crc32", which can be found here: - // (https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics#3915619) + // https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics#3915619 int err = sysctlbyname("hw.optional.armv8_crc32", &has_crc32, &size, NULL, 0); |