Implement more efficient magics generator
Instead of randomly trying magics until a suitable one is found,
a routine is added that finds the magic through purposeful backtracking.
It also does not have to generate attacks to test for collisions; it
guarantees there will be none by preventing harmful collisions between
mask bits when these are placed in the index. That makes it very fast.
Verification of the generated magic is still done, but since the magic
should already be correct the loop for retrying is gone.