mirror of https://git.tukaani.org/xz.git
liblzma: ARM64 CRC32: Tweak coding style and comments
This commit is contained in:
parent
780d2c236d
commit
d8fffd01aa
|
@ -11,7 +11,6 @@
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef LZMA_CRC32_ARM64_H
|
#ifndef LZMA_CRC32_ARM64_H
|
||||||
#define LZMA_CRC32_ARM64_H
|
#define LZMA_CRC32_ARM64_H
|
||||||
|
|
||||||
|
@ -21,6 +20,8 @@
|
||||||
# include <arm_acle.h>
|
# include <arm_acle.h>
|
||||||
#endif
|
#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(CRC32_GENERIC) && defined(CRC32_ARCH_OPTIMIZED)
|
||||||
# if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO)
|
# if defined(HAVE_GETAUXVAL) || defined(HAVE_ELF_AUX_INFO)
|
||||||
# include <sys/auxv.h>
|
# include <sys/auxv.h>
|
||||||
|
@ -36,8 +37,7 @@
|
||||||
//
|
//
|
||||||
// NOTE: Build systems check for this too, keep them in sync with this.
|
// NOTE: Build systems check for this too, keep them in sync with this.
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__EDG__)
|
||||||
# define crc_attr_target \
|
# define crc_attr_target __attribute__((__target__("+crc")))
|
||||||
__attribute__((__target__("+crc")))
|
|
||||||
#else
|
#else
|
||||||
# define crc_attr_target
|
# define crc_attr_target
|
||||||
#endif
|
#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
|
// ignoring the least significant three bits of size to ensure
|
||||||
// we do not process past the bounds of the buffer. This guarantees
|
// 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.
|
// 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)
|
buf < limit; buf += 8)
|
||||||
crc = __crc32d(crc, aligned_read64le(buf));
|
crc = __crc32d(crc, aligned_read64le(buf));
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ is_arch_extension_supported(void)
|
||||||
// The sysctlbyname() function requires a string identifier for the
|
// The sysctlbyname() function requires a string identifier for the
|
||||||
// CPU feature it tests. The Apple documentation lists the string
|
// CPU feature it tests. The Apple documentation lists the string
|
||||||
// "hw.optional.armv8_crc32", which can be found here:
|
// "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,
|
int err = sysctlbyname("hw.optional.armv8_crc32", &has_crc32,
|
||||||
&size, NULL, 0);
|
&size, NULL, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue