ariya.io About Talks Articles

Reverse and 64

1 min read

Next time your candidate claims a deep knowledge of programming, ask him/her why the following line can reverse the bits in a 8-bit byte, along with an explanation why it needs 64-bit arithmetic:

c = (c * 0x0202020202ULL & 0x010884422010ULL) % 1023;

Solution: see the complete hacks.

Related posts:

♡ this article? Explore more articles and follow me Twitter.

Share this on Twitter Facebook