//
///////////////////////////////////////////////////////////////////////////////
-
#ifndef LZMA_CRC32_ARM64_H
#define LZMA_CRC32_ARM64_H
# 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>
//
// 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
// 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));
// 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);