dailybird
4/7/2017 - 3:28 AM

Find the number of 1 in binary.

Find the number of 1 in binary.

int upperBit(x)
{
   int count = 0;
   while(x)
   {
            count++;
            x = x & (x-1);
   }
   return count;
}