A
arunaling
Hi all,
I have the following situation. I want to use the following piece of
code to count the number of bits in an integer I use the following
piece of code.
void bitcount(int k)
{
for (int count =0;k; k&=k-1)
count++;
}
How do I make sure that this piece of code works for unsigned integers
too. Is there any way to do that.
Thanx and Regards,
Aruna
I have the following situation. I want to use the following piece of
code to count the number of bits in an integer I use the following
piece of code.
void bitcount(int k)
{
for (int count =0;k; k&=k-1)
count++;
}
How do I make sure that this piece of code works for unsigned integers
too. Is there any way to do that.
Thanx and Regards,
Aruna