From: Kaspar Schiess Date: 2012-10-26T15:19:38+09:00 Subject: Re: bit count or bit set Hei Charles, Any number of these bit twiddling hacks here: http://www-graphics.stanford.edu/~seander/bithacks.html will translate straight to Ruby. I guess the lookup table approach is easy to implement and reasonably fast. Another strategy would be to implement this in C and load it as an extension. Make sure this is really the hotspot of your code before optimizing... kaspar