Bit hack solution in Speedy category for Binary Count by DiZ
'''Bit twiddling hack by Brian Kernighan.
This method goes through as many iterations as there are set bits.
So if we have a 32-bit word with only the high bit set,
then it will only go once through the loop.'''
c = 0
c += 1
n &= n-1
March 10, 2014