Analyzing the codebase of a high performance caching library
adriacabeza.github.io1 pointsby NovaX0 comments
let shift = ((~(i >> 5) & 1) << 5);
EDIT:
The compiler uses "vpandn" with the conditional version and "vpand" with the bitwise version. The difference is it includes a bitwise logical NOT operation on the first source operand. It looks like the compiler and I are correct, the author's bitwise version is inverted, and the incorrect code was merged in the author's commit. Also, I think this could be reduced to just (~i & 32).
[1] https://docs.google.com/document/d/1gCsFxXamW8RRvOe5hECz98Ft...