Grow the hash table by using prime numbers as bucket count. Slower than tsl::rh::power_of_two_growth_policy in general but will probably distribute the values around better in the buckets with a poor hash function.
To allow the compiler to optimize the modulo operation, a lookup table is used with constant primes numbers.
With a switch the code would look like:
switch(iprime) {
case 0: hash % 5ul;
break;
case 1: hash % 17ul;
break;
case 2: hash % 29ul;
break;
...
}
Due to the constant variable in the modulo the compiler is able to optimize the operation by a series of multiplications, substractions and shifts.
The 'hash % 5' could become something like 'hash - (hash * 0xCCCCCCCD) >> 34)
- 5' in a 64 bits environment.
Definition at line 369 of file robin_growth_policy.h.