File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 8
8
#define HASHUTILS_H
9
9
10
10
/*
11
- * Combine two hash values, resulting in another hash value, with decent bit
12
- * mixing.
11
+ * Combine two 32-bit hash values, resulting in another hash value, with
12
+ * decent bit mixing.
13
13
*
14
14
* Similar to boost's hash_combine().
15
15
*/
@@ -20,6 +20,18 @@ hash_combine(uint32 a, uint32 b)
20
20
return a ;
21
21
}
22
22
23
+ /*
24
+ * Combine two 64-bit hash values, resulting in another hash value, using the
25
+ * same kind of technique as hash_combine(). Testing shows that this also
26
+ * produces good bit mixing.
27
+ */
28
+ static inline uint64
29
+ hash_combine64 (uint64 a , uint64 b )
30
+ {
31
+ /* 0x49a0f4dd15e5a8e3 is 64bit random data */
32
+ a ^= b + 0x49a0f4dd15e5a8e3 + (a << 54 ) + (a >> 7 );
33
+ return a ;
34
+ }
23
35
24
36
/*
25
37
* Simple inline murmur hash implementation hashing a 32 bit integer, for
You can’t perform that action at this time.
0 commit comments