3 ms·
Awesome. I'm always amazed by bitmagic like this. Today I saw one on stackoverflow and spent a good deal of time failing to understand it: https://stackoverflo
by personjerry 11y ago
Awesome. I'm always amazed by bitmagic like this. Today I saw one on stackoverflow and spent a good deal of time failing to understand it:
https://stackoverflow.com/questions/33532045/how-to-swap-first-2-consecutive-different-bits https://stackoverflow.com/questions/33532045/how-to-swap-fir...
And of course I'm reminded of the fast inverse square root:
https://en.wikipedia.org/wiki/Fast_inverse_square_root https://en.wikipedia.org/wiki/Fast_inverse_square_root