/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
+ *
* HashKit library
*
* Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
* Add big endian support
*/
-#include <libhashkit/common.h>
+#include "libhashkit/common.h"
#define hashsize(n) ((uint32_t)1<<(n))
#define hashmask(n) (hashsize(n)-1)
In which case, the hash table should have hashsize(10) elements.
*/
+#if HAVE_ASAN
+__attribute__((no_sanitize_address,no_sanitize("address")))
+#endif
uint32_t hashkit_jenkins(const char *key, size_t length, void *)
{
uint32_t a,b,c; /* internal state */
-#ifndef WORDS_BIGENDIAN
+#if !WORDS_BIGENDIAN
union { const void *ptr; size_t i; } u;
u.ptr = key;
#endif
/* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32_t)length) + JENKINS_INITVAL;
-#ifndef WORDS_BIGENDIAN
+#if !WORDS_BIGENDIAN
if ((u.i & 0x3) == 0)
{
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
case 0 : return c;
default : return c;
}
-#ifndef WORDS_BIGENDIAN
+#if !WORDS_BIGENDIAN
}
#endif