From 419484b934222e589f0b718e9494b045df176167 Mon Sep 17 00:00:00 2001 From: Aaron Carroll Date: Fri, 12 Sep 2008 10:57:13 +0200 Subject: [PATCH] Don't compile crc32c-intel on non-x86 platforms crc32c_intel() doesn't make sense on platforms without SSE, so alias it to crc32c() on such machines. Signed-off-by: Aaron Carroll Signed-off-by: Jens Axboe --- arch/arch-x86.h | 1 + arch/arch-x86_64.h | 1 + crc/crc32c-intel.c | 6 ++++++ crc/crc32c.h | 7 +++++++ 4 files changed, 15 insertions(+) diff --git a/arch/arch-x86.h b/arch/arch-x86.h index 97262ffe..9631437e 100644 --- a/arch/arch-x86.h +++ b/arch/arch-x86.h @@ -39,5 +39,6 @@ static inline unsigned long arch_ffz(unsigned long bitmask) return bitmask; } #define ARCH_HAVE_FFZ +#define ARCH_HAVE_SSE #endif diff --git a/arch/arch-x86_64.h b/arch/arch-x86_64.h index 216e74e2..457714c8 100644 --- a/arch/arch-x86_64.h +++ b/arch/arch-x86_64.h @@ -39,5 +39,6 @@ static inline unsigned int arch_ffz(unsigned int bitmask) return bitmask; } #define ARCH_HAVE_FFZ +#define ARCH_HAVE_SSE #endif diff --git a/crc/crc32c-intel.c b/crc/crc32c-intel.c index c0abe73a..cec5ad5d 100644 --- a/crc/crc32c-intel.c +++ b/crc/crc32c-intel.c @@ -1,4 +1,5 @@ #include +#include "crc32c.h" /* * Based on a posting to lkml by Austin Zhang @@ -11,6 +12,8 @@ * Volume 2A: Instruction Set Reference, A-M */ +#ifdef ARCH_HAVE_SSE + #if BITS_PER_LONG == 64 #define REX_PRE "0x48, " #define SCALE_F 8 @@ -64,3 +67,6 @@ uint32_t crc32c_intel(unsigned char const *data, unsigned long length) return crc; } + +#endif /* ARCH_HAVE_SSE */ + diff --git a/crc/crc32c.h b/crc/crc32c.h index cf171369..0976261a 100644 --- a/crc/crc32c.h +++ b/crc/crc32c.h @@ -18,7 +18,14 @@ #ifndef CRC32C_H #define CRC32C_H +#include "../arch/arch.h" + extern uint32_t crc32c(unsigned char const *, unsigned long); + +#ifdef ARCH_HAVE_SSE extern uint32_t crc32c_intel(unsigned char const *, unsigned long); +#else +#define crc32c_intel crc32c +#endif #endif -- 2.25.1