crc32c: use bool
authorJens Axboe <axboe@kernel.dk>
Thu, 22 Jun 2017 20:03:14 +0000 (14:03 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 22 Jun 2017 20:03:14 +0000 (14:03 -0600)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
crc/crc32c-arm64.c
crc/crc32c-intel.c
crc/crc32c.h

index c3f42c7cd0ace8fbaef7acbbace2e2c9548b7303..08177ba6cff66e78884eaed9148c6909a67097b8 100644 (file)
@@ -19,7 +19,7 @@
 #define HWCAP_CRC32             (1 << 7)
 #endif /* HWCAP_CRC32 */
 
-int crc32c_arm64_available = 0;
+bool crc32c_arm64_available = false;
 
 #ifdef ARCH_HAVE_ARM64_CRC_CRYPTO
 
@@ -27,7 +27,7 @@ int crc32c_arm64_available = 0;
 #include <arm_acle.h>
 #include <arm_neon.h>
 
-static int crc32c_probed;
+static bool crc32c_probed;
 
 /*
  * Function to calculate reflected crc with PMULL Instruction
@@ -106,9 +106,8 @@ void crc32c_arm64_probe(void)
 
        if (!crc32c_probed) {
                hwcap = getauxval(AT_HWCAP);
-               if (hwcap & HWCAP_CRC32)
-                       crc32c_arm64_available = 1;
-               crc32c_probed = 1;
+               crc32c_arm64_available = (hwcap & HWCAP_CRC32) != 0;
+               crc32c_probed = true;
        }
 }
 
index 0b0f193c0564a75de8d5d00e80695af40e49dd6a..05a087dcb6060f919deca5dc94699e58eee8bbe5 100644 (file)
@@ -18,7 +18,7 @@
  * Volume 2A: Instruction Set Reference, A-M
  */
 
-int crc32c_intel_available = 0;
+bool crc32c_intel_available = false;
 
 #ifdef ARCH_HAVE_SSE4_2
 
@@ -30,7 +30,7 @@ int crc32c_intel_available = 0;
 #define SCALE_F 4
 #endif
 
-static int crc32c_probed;
+static bool crc32c_probed;
 
 static uint32_t crc32c_intel_le_hw_byte(uint32_t crc, unsigned char const *data,
                                        unsigned long length)
@@ -87,7 +87,7 @@ void crc32c_intel_probe(void)
 
                do_cpuid(&eax, &ebx, &ecx, &edx);
                crc32c_intel_available = (ecx & (1 << 20)) != 0;
-               crc32c_probed = 1;
+               crc32c_probed = true;
        }
 }
 
index 5d664079b940fcb1691ceb569e7882fee7b57966..d513f3aa5403df89fb9e9ee1b709561bf868681f 100644 (file)
 #define CRC32C_H
 
 #include "../arch/arch.h"
+#include "../lib/types.h"
 
 extern uint32_t crc32c_sw(unsigned char const *, unsigned long);
-extern int crc32c_arm64_available;
-extern int crc32c_intel_available;
+extern bool crc32c_arm64_available;
+extern bool crc32c_intel_available;
 
 #ifdef ARCH_HAVE_ARM64_CRC_CRYPTO
 extern uint32_t crc32c_arm64(unsigned char const *, unsigned long);