]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: ARM64 CRC32: Tweak coding style and comments
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 10 Apr 2024 18:55:10 +0000 (21:55 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 10 Apr 2024 19:53:53 +0000 (22:53 +0300)
src/liblzma/check/crc32_arm64.h

index 6cdb5dab32e639bd191b705aae74ff4a74e10b68..f9a431550fa1e35b63a1beb2e748361421cfc2ea 100644 (file)
@@ -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);