Monday, July 28, 2008

C Source code for counting 1's in a number.

int bitcount (unsigned int n)
{
int count=0;
int counter =0;
while (n)
{
count += n & 0x1u ;
n >>= 1 ;
counter++;
}
return count ;
}

No comments:

Your Title