| 584 | } |
| 585 | |
| 586 | dictEntry *HashTableFind(dict *d, const void *key) |
| 587 | { |
| 588 | dictEntry *he; |
| 589 | uint64_t h, idx, table; |
| 590 | |
| 591 | if (dictSize(d) == 0) return NULL; /* dict is empty */ |
| 592 | if (dictIsRehashing(d)) _dictRehashStep(d); |
| 593 | h = dictHashKey(d, key); |
| 594 | //printf("HashTableFind hash: %llu\n", h); |
| 595 | for (table = 0; table <= 1; table++) { |
| 596 | idx = h & DICTHT_SIZE_MASK(d->ht_size_exp[table]); |
| 597 | he = d->ht_table[table][idx]; |
| 598 | while(he) { |
| 599 | //printf("key: %llu, he->key: %llu\n", key, he->key); |
| 600 | if (key==he->key || dictCompareKeys(d, key, he->key)) { |
| 601 | //printf("keys are the same!\n"); |
| 602 | return he; |
| 603 | } |
| 604 | he = he->next; |
| 605 | } |
| 606 | if (!dictIsRehashing(d)) return NULL; |
| 607 | } |
| 608 | return NULL; |
| 609 | } |
| 610 | |
| 611 | void *HashTableFetchValue(dict *d, const void *key) { |
| 612 | dictEntry *he; |
no test coverage detected