And don't forget that you still have a switch statement with multiple branching operations that pick out this code among the various options of hash table size!
This is something where function pointers / overloading would likely have even better performance than direct switching - when the hash table size changes, switch out the function from modulo_by_511 to modulo_by_711.