From: "Bartosz DziewoƄski" Date: 2012-10-26T06:00:22+09:00 Subject: Re: bit count or bit set 2012/10/25 Charles Hixson : > In Ruby1.9 is there any good way to count the number of on bits in an > integer (after an & operation)? number.to_s(2).count('1')? I'm not sure how fast this is going to be, but might turn out to be faster than a simple while loop. -- Matma Rex