projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge in additional fix for manpages.
[m6w6/libmemcached]
/
libhashkit
/
murmur.c
diff --git
a/libhashkit/murmur.c
b/libhashkit/murmur.c
index cd5e6419ab001c5cfdd3800e118e723585c8355b..a40b11b744d819fae62d6697b27caace7d1ff578 100644
(file)
--- a/
libhashkit/murmur.c
+++ b/
libhashkit/murmur.c
@@
-1,4
+1,4
@@
-/*
+/*
"Murmur" hash provided by Austin, tanjent@gmail.com
http://murmurhash.googlepages.com/
"Murmur" hash provided by Austin, tanjent@gmail.com
http://murmurhash.googlepages.com/
@@
-15,11
+15,11
@@
Updated to murmur2 hash - BP
*/
Updated to murmur2 hash - BP
*/
-#include
"common.h"
+#include
<libhashkit/common.h>
-uint32_t hashkit_murmur(const char *key, size_t length)
+uint32_t hashkit_murmur(const char *key, size_t length
, void *context
)
{
{
- /*
+ /*
'm' and 'r' are mixing constants generated offline. They're not
really 'magic', they just happen to work well.
*/
'm' and 'r' are mixing constants generated offline. They're not
really 'magic', they just happen to work well.
*/
@@
-36,16
+36,17
@@
uint32_t hashkit_murmur(const char *key, size_t length)
// Mix 4 bytes at a time into the hash
const unsigned char * data= (const unsigned char *)key;
// Mix 4 bytes at a time into the hash
const unsigned char * data= (const unsigned char *)key;
+ (void)context;
while(length >= 4)
{
unsigned int k = *(unsigned int *)data;
while(length >= 4)
{
unsigned int k = *(unsigned int *)data;
- k *= m;
- k ^= k >> r;
- k *= m;
+ k *= m;
+ k ^= k >> r;
+ k *= m;
- h *= m;
+ h *= m;
h ^= k;
data += 4;
h ^= k;
data += 4;
@@
-63,9
+64,9
@@
uint32_t hashkit_murmur(const char *key, size_t length)
default: break;
};
default: break;
};
- /*
+ /*
Do a few final mixes of the hash to ensure the last few bytes are
Do a few final mixes of the hash to ensure the last few bytes are
- well-incorporated.
+ well-incorporated.
*/
h ^= h >> 13;
*/
h ^= h >> 13;