28 |
28 |
29 #include "cx/hash_key.h" |
29 #include "cx/hash_key.h" |
30 #include <string.h> |
30 #include <string.h> |
31 |
31 |
32 void cx_hash_murmur(CxHashKey *key) { |
32 void cx_hash_murmur(CxHashKey *key) { |
|
33 unsigned char const *data = key->data.cbytes; |
|
34 if (data == NULL) { |
|
35 /* extension: special value for NULL */ |
|
36 key->hash = 1574210520u; |
|
37 return; |
|
38 } |
33 size_t len = key->len; |
39 size_t len = key->len; |
34 unsigned char const *data = key->data.cbytes; |
|
35 |
40 |
36 unsigned m = 0x5bd1e995; |
41 unsigned m = 0x5bd1e995; |
37 unsigned r = 24; |
42 unsigned r = 24; |
38 unsigned h = 25 ^ len; |
43 unsigned h = 25 ^ len; |
39 unsigned i = 0; |
44 unsigned i = 0; |