18
18
// thus murmur2-hash is used
19
19
20
20
21
- // specializations of https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp
22
- // it is possible to have a special x64-version, which would need less operations, but
23
- // using 32bit version always has also some benifits:
24
- // - one code for 32bit and 64bit builds
25
- // - the same case for 32bit and 64bit builds
26
- // - no performance difference could be measured compared to a possible x64-version
27
-
28
- khint32_t PANDAS_INLINE murmur2_32_32to32 (khint32_t k1 , khint32_t k2 ){
21
+ // specializations of
22
+ // https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp
23
+ // it is possible to have a special x64-version, which would need less
24
+ // operations,but using 32bit version always has also some benifits:
25
+ // - one code for 32bit and 64bit builds
26
+ // - the same case for 32bit and 64bit builds
27
+ // - no performance difference could be measured compared
28
+ // to a possible x64-version
29
+
30
+ khint32_t PANDAS_INLINE murmur2_32_32to32 (khint32_t k1 , khint32_t k2 ) {
29
31
const khint32_t SEED = 0xc70f6907UL ;
30
32
// 'm' and 'r' are mixing constants generated offline.
31
33
// They're not really 'magic', they just happen to work well.
@@ -35,15 +37,15 @@ khint32_t PANDAS_INLINE murmur2_32_32to32(khint32_t k1, khint32_t k2){
35
37
// Initialize the hash to a 'random' value
36
38
khint32_t h = SEED ^ 4 ;
37
39
38
- //handle first 4 bytes:
40
+ // handle first 4 bytes:
39
41
k1 *= M_32 ;
40
42
k1 ^= k1 >> R_32 ;
41
43
k1 *= M_32 ;
42
44
43
45
h *= M_32 ;
44
46
h ^= k1 ;
45
47
46
- //handle second 4 bytes:
48
+ // handle second 4 bytes:
47
49
k2 *= M_32 ;
48
50
k2 ^= k2 >> R_32 ;
49
51
k2 *= M_32 ;
@@ -59,7 +61,7 @@ khint32_t PANDAS_INLINE murmur2_32_32to32(khint32_t k1, khint32_t k2){
59
61
return h ;
60
62
}
61
63
62
- khint32_t PANDAS_INLINE murmur2_64to32 (khint64_t k ){
64
+ khint32_t PANDAS_INLINE murmur2_64to32 (khint64_t k ) {
63
65
khint32_t k1 = (khint32_t )k ;
64
66
khint32_t k2 = (khint32_t )(k >> 32 );
65
67
@@ -76,13 +78,13 @@ khint64_t PANDAS_INLINE asint64(double key) {
76
78
#define ZERO_HASH 0
77
79
#define NAN_HASH 0
78
80
79
- khint32_t PANDAS_INLINE kh_float64_hash_func (double val ){
81
+ khint32_t PANDAS_INLINE kh_float64_hash_func (double val ) {
80
82
// 0.0 and -0.0 should have the same hash:
81
- if (val == 0.0 ){
83
+ if (val == 0.0 ) {
82
84
return ZERO_HASH ;
83
85
}
84
86
// all nans should have the same hash:
85
- if ( val != val ){
87
+ if ( val != val ) {
86
88
return NAN_HASH ;
87
89
}
88
90
khint64_t as_int = asint64 (val );
0 commit comments