summaryrefslogtreecommitdiff
path: root/crc
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-06-22 14:03:14 -0600
committerJens Axboe <axboe@kernel.dk>2017-06-22 14:03:14 -0600
commit97211af31edb8bcb2d85fa6f8873ded829c2e368 (patch)
tree58b32b8a47cffc8f8e4cd6a56b6357d10558565c /crc
parent22bcb265833f263facd58bcef3d8a159c554460e (diff)
crc32c: use bool
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'crc')
-rw-r--r--crc/crc32c-arm64.c9
-rw-r--r--crc/crc32c-intel.c6
-rw-r--r--crc/crc32c.h5
3 files changed, 10 insertions, 10 deletions
diff --git a/crc/crc32c-arm64.c b/crc/crc32c-arm64.c
index c3f42c7..08177ba 100644
--- a/crc/crc32c-arm64.c
+++ b/crc/crc32c-arm64.c
@@ -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;
}
}
diff --git a/crc/crc32c-intel.c b/crc/crc32c-intel.c
index 0b0f193..05a087d 100644
--- a/crc/crc32c-intel.c
+++ b/crc/crc32c-intel.c
@@ -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;
}
}
diff --git a/crc/crc32c.h b/crc/crc32c.h
index 5d66407..d513f3a 100644
--- a/crc/crc32c.h
+++ b/crc/crc32c.h
@@ -19,10 +19,11 @@
#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);