X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libhashkit%2Ffnv_64.cc;h=68e4dd07ef564084cf87b47a1994b7da41d428e2;hb=3347080c209fd333955a73b2798be4f98b84d27f;hp=842e1d5c77db9112569a554a48b91c3f8826acd3;hpb=77606accc7f17a79feaaf54041408cdba6febaf2;p=awesomized%2Flibmemcached diff --git a/libhashkit/fnv_64.cc b/libhashkit/fnv_64.cc index 842e1d5c..68e4dd07 100644 --- a/libhashkit/fnv_64.cc +++ b/libhashkit/fnv_64.cc @@ -2,7 +2,7 @@ * * HashKit library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2009 Brian Aker All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,15 +38,16 @@ #include +#if __WORDSIZE == 64 && defined(HAVE_FNV64_HASH) + /* FNV hash'es lifted from Dustin Sallings work */ -static uint64_t FNV_64_INIT= 0xcbf29ce484222325LLU; -static uint64_t FNV_64_PRIME= 0x100000001b3LLU; +static uint64_t FNV_64_INIT= 0xcbf29ce484222325; +static uint64_t FNV_64_PRIME= 0x100000001b3; -uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context) +uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *) { /* Thanks to pierre@demartines.com for the pointer */ uint64_t hash= FNV_64_INIT; - (void)context; for (size_t x= 0; x < key_length; x++) { @@ -57,10 +58,9 @@ uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context) return (uint32_t)hash; } -uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context) +uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *) { uint32_t hash= (uint32_t) FNV_64_INIT; - (void)context; for (size_t x= 0; x < key_length; x++) { @@ -71,3 +71,15 @@ uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context) return hash; } + +#else +uint32_t hashkit_fnv1_64(const char *, size_t, void *) +{ + return 0; +} + +uint32_t hashkit_fnv1a_64(const char *, size_t, void *) +{ + return 0; +} +#endif