counts the number of 1-bits in its integer argument: - C Function

C examples for Function:Utility Function

Description

counts the number of 1-bits in its integer argument:

int bitcounter(unsigned int y)
{
  int g;
  for(g = 0; y != 0; y >>= 1)
    if(y & 01)
      g++;
  return g;
}

Related Tutorials