Jun 23, 2009

determine if a number is a power of 2

determine if a number is a power of 2
bool foo(int num)
{
if(num&(num-1))
return true;
return false;
}

No comments:

Post a Comment