I am confused by the following code.
If I understand correctly, it relies on the fact that the capacity is a power of 2.
x & capacity-1 is then a convoluted way to express
x < capacity.
What I don’t get, is how is this an improvement, why is this an improvement over using
Both compile to a conditional move instruction.