I also recommend this much more complete article on bit hacks:
http://graphics.stanford.edu/~seander/bithacks.html
I also recommend this much more complete article on bit hacks:
http://graphics.stanford.edu/~seander/bithacks.html