My blog has been moved to

Monday, December 04, 2006

Reverse and 64

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.

No comments: