3 ms·
If you're into bit hacks... Though K&R is on the shelf within reach and I knew it had a good algorithm for counting set bits (ones), I also remembered reading
by jcr 14y ago
If you're into bit hacks...
Though K&R is on the shelf within reach and I knew it had
a good algorithm for counting set bits (ones), I also remembered
reading about a more efficient method a while back. The following
page covers a number of set bit counting hacks:
http://graphics.stanford.edu/~seander/bithacks.html http://graphics.stanford.edu/~seander/bithacks.html