vppinfra: use 64-bit crc32 instruction in bihash_24_8

Change-Id: Ibeb6d35e15a8d332753df7c352c0b51c277a0ee5
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/vnet/vnet/map/map.c b/vnet/vnet/map/map.c
index beeaf11..aeec6a9 100644
--- a/vnet/vnet/map/map.c
+++ b/vnet/vnet/map/map.c
@@ -22,7 +22,15 @@
 
 #include "map.h"
 
-#ifndef __SSE4_2__
+#ifdef __SSE4_2__
+static inline u32
+crc_u32 (u32 data, u32 value)
+{
+  __asm__ volatile ("crc32l %[data], %[value];":[value] "+r" (value):[data]
+		    "rm" (data));
+  return value;
+}
+#else
 #include <vppinfra/xxhash.h>
 
 static inline u32
diff --git a/vppinfra/vppinfra/bihash_24_8.h b/vppinfra/vppinfra/bihash_24_8.h
index 17e99bf..353f06b 100644
--- a/vppinfra/vppinfra/bihash_24_8.h
+++ b/vppinfra/vppinfra/bihash_24_8.h
@@ -40,38 +40,20 @@
   return 0;
 }
 
+static inline u64
+clib_bihash_hash_24_8 (const clib_bihash_kv_24_8_t * v)
+{
 #if __SSE4_2__
-static inline u32
-crc_u32 (u32 data, u32 value)
-{
-  __asm__ volatile ("crc32l %[data], %[value];":[value] "+r" (value):[data]
-		    "rm" (data));
-  return value;
-}
-
-static inline u64
-clib_bihash_hash_24_8 (const clib_bihash_kv_24_8_t * v)
-{
-  const u32 *dp = (const u32 *) &v->key[0];
   u32 value = 0;
-
-  value = crc_u32 (dp[0], value);
-  value = crc_u32 (dp[1], value);
-  value = crc_u32 (dp[2], value);
-  value = crc_u32 (dp[3], value);
-  value = crc_u32 (dp[4], value);
-  value = crc_u32 (dp[5], value);
-
+  value = _mm_crc32_u64 (value, v->key[0]);
+  value = _mm_crc32_u64 (value, v->key[1]);
+  value = _mm_crc32_u64 (value, v->key[2]);
   return value;
-}
 #else
-static inline u64
-clib_bihash_hash_24_8 (const clib_bihash_kv_24_8_t * v)
-{
   u64 tmp = v->key[0] ^ v->key[1] ^ v->key[2];
   return clib_xxhash (tmp);
-}
 #endif
+}
 
 static inline u8 *
 format_bihash_kvp_24_8 (u8 * s, va_list * args)