Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
int count_bits(int n)
{
int sum;
for(sum=0;n!=0;n&=n-1)
sum++;
return sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment