From 0f68c79a9d8533d492c8221f924b14cf4e222136 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 26 Apr 2017 13:05:05 +0200 Subject: Add crc32c inline function, allows compilation on 32-bit systems 32-bit code still can use crc32c instructions, but it operates on 32 registers Change-Id: I9bb6b0b59635d6ea6a753584676ebcf59c8f6584 Signed-off-by: Damjan Marion --- src/plugins/acl/bihash_40_8.h | 9 ++------- src/plugins/lb/lbhash.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/acl/bihash_40_8.h b/src/plugins/acl/bihash_40_8.h index ba3dfbeaaf0..1dfb6a1eb14 100644 --- a/src/plugins/acl/bihash_40_8.h +++ b/src/plugins/acl/bihash_40_8.h @@ -24,6 +24,7 @@ #include #include #include +#include typedef struct { @@ -44,13 +45,7 @@ static inline u64 clib_bihash_hash_40_8 (const clib_bihash_kv_40_8_t * v) { #if __SSE4_2__ - u32 value = 0; - value = _mm_crc32_u64 (value, v->key[0]); - value = _mm_crc32_u64 (value, v->key[1]); - value = _mm_crc32_u64 (value, v->key[2]); - value = _mm_crc32_u64 (value, v->key[3]); - value = _mm_crc32_u64 (value, v->key[4]); - return value; + return clib_crc32c ((u8 *) v->key, 40); #else u64 tmp = v->key[0] ^ v->key[1] ^ v->key[2] ^ v->key[3] ^ v->key[4]; return clib_xxhash (tmp); diff --git a/src/plugins/lb/lbhash.h b/src/plugins/lb/lbhash.h index ca3cc143dc2..c514fb57d75 100644 --- a/src/plugins/lb/lbhash.h +++ b/src/plugins/lb/lbhash.h @@ -101,7 +101,7 @@ void lb_hash_free(lb_hash_t *h) vec_free(mem); } -#if __SSE4_2__ +#if __SSE4_2__ && !defined (__i386__) static_always_inline u32 lb_hash_hash(u64 k0, u64 k1, u64 k2, u64 k3, u64 k4) { -- cgit 1.2.3-korg