MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / _dictNextPower

Function _dictNextPower

src/dict.cpp:1377–1387  ·  view source on GitHub ↗

Our hash table capability is a power of two */

Source from the content-addressed store, hash-verified

1375
1376/* Our hash table capability is a power of two */
1377static unsigned long _dictNextPower(unsigned long size)
1378{
1379 unsigned long i = DICT_HT_INITIAL_SIZE;
1380
1381 if (size >= LONG_MAX) return LONG_MAX + 1LU;
1382 while(1) {
1383 if (i >= size)
1384 return i;
1385 i *= 2;
1386 }
1387}
1388
1389/* Returns the index of a free slot that can be populated with
1390 * a hash entry for the given 'key'.

Callers 2

_dictExpandFunction · 0.70
dictTypeExpandAllowedFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected