Bit Twiddling Hacks

23 Jan graphics.stanford.edu
Methods for counting bits, etc. Especially interesting is "the best method for counting bits"