X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Flibhashkit%2Fjenkins.cc;h=65aa1d11c6110269fc46e0bf7ea20e098a45200a;hb=fb3710011600c04359d26615be7a92df1742a3e9;hp=3c6558a42ad9a21d9980dcb8983056f9dd073e1e;hpb=5e760300d15ef4c5b7eed3fb9f37920ebca2f6ec;p=m6w6%2Flibmemcached diff --git a/src/libhashkit/jenkins.cc b/src/libhashkit/jenkins.cc index 3c6558a4..65aa1d11 100644 --- a/src/libhashkit/jenkins.cc +++ b/src/libhashkit/jenkins.cc @@ -1,5 +1,5 @@ /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: - * + * * HashKit library * * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ @@ -48,7 +48,7 @@ * Add big endian support */ -#include +#include "libhashkit/common.h" #define hashsize(n) ((uint32_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) @@ -93,10 +93,13 @@ use a bitmask. For example, if you need only 10 bits, do 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 @@ -104,7 +107,7 @@ uint32_t hashkit_jenkins(const char *key, size_t length, void *) /* 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 */ @@ -259,7 +262,7 @@ uint32_t hashkit_jenkins(const char *key, size_t length, void *) case 0 : return c; default : return c; } -#ifndef WORDS_BIGENDIAN +#if !WORDS_BIGENDIAN } #endif