Last active
December 28, 2018 09:19
-
-
Save lpe234/cf60fd18191a396257f92b7d52e1613b to your computer and use it in GitHub Desktop.
redis-core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 💕核心科技~ | |
dictEntry *dictFind(dict *d, const void *key) | |
{ | |
dictEntry *he; | |
unsigned int h, idx, table; | |
if (d->ht[0].size == 0) return NULL; /* We don't have a table at all */ | |
if (dictIsRehashing(d)) _dictRehashStep(d); | |
h = dictHashKey(d, key); | |
for (table = 0; table <= 1; table++) { | |
idx = h & d->ht[table].sizemask; | |
he = d->ht[table].table[idx]; | |
while(he) { | |
if (dictCompareKeys(d, key, he->key)) | |
return he; | |
he = he->next; | |
} | |
if (!dictIsRehashing(d)) return NULL; | |
} | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment