src/hash_key.c

changeset 628
1e2be40f0cb5
parent 604
056e5f592d84
child 678
78f943d76f50
equal deleted inserted replaced
627:cc8cbabd27cd 628:1e2be40f0cb5
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; 33 unsigned char const *data = key->data.cbytes;
34 if (data == NULL) { 34 if (data == NULL) {
35 /* extension: special value for NULL */ 35 // extension: special value for NULL
36 key->hash = 1574210520u; 36 key->hash = 1574210520u;
37 return; 37 return;
38 } 38 }
39 size_t len = key->len; 39 size_t len = key->len;
40 40
68 __attribute__((__fallthrough__)); 68 __attribute__((__fallthrough__));
69 case 1: 69 case 1:
70 h ^= (data[i + 0] & 0xFF); 70 h ^= (data[i + 0] & 0xFF);
71 h *= m; 71 h *= m;
72 __attribute__((__fallthrough__)); 72 __attribute__((__fallthrough__));
73 default: 73 default: // do nothing
74 /* do nothing */; 74 ;
75 } 75 }
76 76
77 h ^= h >> 13; 77 h ^= h >> 13;
78 h *= m; 78 h *= m;
79 h ^= h >> 15; 79 h ^= h >> 15;

mercurial