@@ -219,12 +219,6 @@ khint32_t PANDAS_INLINE murmur2_64to32(khint64_t k){
219
219
}
220
220
221
221
222
- #ifdef KHASH_LINEAR
223
- #define __ac_inc (k , m ) 1
224
- #else
225
- #define __ac_inc (k , m ) (murmur2_32to32(k) | 1) & (m)
226
- #endif
227
-
228
222
#define __ac_fsize (m ) ((m) < 32? 1 : (m)>>5)
229
223
230
224
#ifndef kroundup32
@@ -276,12 +270,12 @@ static const double __ac_HASH_UPPER = 0.77;
276
270
SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \
277
271
{ \
278
272
if (h->n_buckets) { \
279
- khint_t inc, k, i, last, mask; \
273
+ khint_t k, i, last, mask, step = 0 ; \
280
274
mask = h->n_buckets - 1; \
281
275
k = __hash_func(key); i = k & mask; \
282
- inc = __ac_inc(k, mask); last = i; /* inc==1 for linear probing */ \
276
+ last = i; /* inc==1 for linear probing */ \
283
277
while (!__ac_isempty (h -> flags , i ) && (__ac_isdel (h -> flags , i ) || !__hash_equal (h -> keys [i ], key ))) { \
284
- i = (i + inc ) & mask ; \
278
+ i = (i + ( ++ step ) ) & mask ; \
285
279
if (i == last ) return h -> n_buckets ; \
286
280
} \
287
281
return __ac_iseither (h -> flags , i )? h -> n_buckets : i ; \
@@ -314,11 +308,10 @@ static const double __ac_HASH_UPPER = 0.77;
314
308
if (kh_is_map ) val = h -> vals [j ]; \
315
309
__ac_set_isempty_true (h -> flags , j ); \
316
310
while (1 ) { /* kick-out process; sort of like in Cuckoo hashing */ \
317
- khint_t inc , k , i ; \
311
+ khint_t k , i , step = 0 ; \
318
312
k = __hash_func (key ); \
319
313
i = k & new_mask ; \
320
- inc = __ac_inc (k , new_mask ); \
321
- while (!__ac_isempty (new_flags , i )) i = (i + inc ) & new_mask ; \
314
+ while (!__ac_isempty (new_flags , i )) i = (i + (++ step )) & new_mask ; \
322
315
__ac_set_isempty_false (new_flags , i ); \
323
316
if (i < h -> n_buckets && __ac_iseither (h -> flags , i ) == 0 ) { /* kick out the existing element */ \
324
317
{ khkey_t tmp = h -> keys [i ]; h -> keys [i ] = key ; key = tmp ; } \
@@ -351,14 +344,14 @@ static const double __ac_HASH_UPPER = 0.77;
351
344
else kh_resize_ ##name (h, h->n_buckets + 1); /* expand the hash table */ \
352
345
} /* TODO: to implement automatically shrinking; resize() already support shrinking */ \
353
346
{ \
354
- khint_t inc , k , i , site , last , mask = h -> n_buckets - 1 ; \
347
+ khint_t k , i , site , last , mask = h -> n_buckets - 1 , step = 0 ; \
355
348
x = site = h -> n_buckets ; k = __hash_func (key ); i = k & mask ; \
356
349
if (__ac_isempty (h -> flags , i )) x = i ; /* for speed up */ \
357
350
else { \
358
- inc = __ac_inc ( k , mask ); last = i ; \
351
+ last = i ; \
359
352
while (!__ac_isempty (h -> flags , i ) && (__ac_isdel (h -> flags , i ) || !__hash_equal (h -> keys [i ], key ))) { \
360
353
if (__ac_isdel (h -> flags , i )) site = i ; \
361
- i = (i + inc ) & mask ; \
354
+ i = (i + ( ++ step )) & mask ; \
362
355
if (i == last ) { x = site ; break ; } \
363
356
} \
364
357
if (x == h -> n_buckets ) { \
0 commit comments