<span style="font-size:24px;">#include <stdio.h>
int count_bit(unsigned int value)
{
int count=0; //15->1111 1111 & 1110 = 1110
while(value) //1110 & 1101 = 1100
{ <span style="white-space:pre"> </span>//1100 & 1001 = 1000
count++; //1000 & 0111 = 0000
value=value & (value-1);
}
return count;
}
int main()
{
int ret=0;
ret=count_bit(15);
printf("%d\n",ret);
return 0;
}</span>