File tree 1 file changed +29
-1
lines changed
1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -143,10 +143,38 @@ typedef khint_t khiter_t;
143
143
#define __ac_set_isboth_false (flag , i ) __ac_set_isempty_false(flag, i)
144
144
#define __ac_set_isdel_true (flag , i ) ((void)0)
145
145
146
+
147
+ // specializations of https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp
148
+ khint32_t PANDAS_INLINE murmur2_32to32 (khint32_t k ){
149
+ const khint32_t SEED = 0xc70f6907UL ;
150
+ // 'm' and 'r' are mixing constants generated offline.
151
+ // They're not really 'magic', they just happen to work well.
152
+ const khint32_t M_32 = 0x5bd1e995 ;
153
+ const int R_32 = 24 ;
154
+
155
+ // Initialize the hash to a 'random' value
156
+ khint32_t h = SEED ^ 4 ;
157
+
158
+ //handle 4 bytes:
159
+ k *= M_32 ;
160
+ k ^= k >> R_32 ;
161
+ k *= M_32 ;
162
+
163
+ h *= M_32 ;
164
+ h ^= k ;
165
+
166
+ // Do a few final mixes of the hash to ensure the "last few
167
+ // bytes" are well-incorporated. (Really needed here?)
168
+ h ^= h >> 13 ;
169
+ h *= M_32 ;
170
+ h ^= h >> 15 ;
171
+ return h ;
172
+ }
173
+
146
174
#ifdef KHASH_LINEAR
147
175
#define __ac_inc (k , m ) 1
148
176
#else
149
- #define __ac_inc (k , m ) (((k)>>3 ^ (k)<<3 ) | 1) & (m)
177
+ #define __ac_inc (k , m ) (murmur2_32to32(k ) | 1) & (m)
150
178
#endif
151
179
152
180
#define __ac_fsize (m ) ((m) < 32? 1 : (m)>>5)
You can’t perform that action at this time.
0 commit comments