What advantage does this function have over a more “conventional” implementation?
int foo (int n)
{
int k = 0;
int t;
while (t = n & -n) {
++k;
n &= ~t;
}
return k;
}
— ADVERTISMENT—
—Advertise Here—
— ADVERTISMENT—
—Advertise Here—