About _dictNextPower function #1200

xuxiaoliang opened this Issue Jul 18, 2013 · 0 comments

2 participants


/* Our hash table capability is a power of two */
static unsigned long _dictNextPower(unsigned long size)
unsigned long i = DICT_HT_INITIAL_SIZE;

if (size >= LONG_MAX) return LONG_MAX;
while(1) {
    if (i >= size)
        return i;
    i *= 2;

if size >=LONG_MAX, the value of return dont match 2^n;
dont use the trick key%size == key&sizemask.

@mattsta mattsta closed this Aug 1, 2014
@JackieXie168 JackieXie168 pushed a commit that referenced this issue Sep 16, 2014
Slava Akhmechet Fixes #1200. http://www.youtube.com/watch?v=sEhPTnWnXf8 d327aaf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment