D
David T. Ashley
What is the most economical test in 'C' for "integer is a power of 2"?
For example, something better than:
void is_2_pow(int arg)
{
return((x == 1) || (x == 2) || (x == 4) || (x == 8) || (x == 16) /* and
so on */ );
}
For example, something better than:
void is_2_pow(int arg)
{
return((x == 1) || (x == 2) || (x == 4) || (x == 8) || (x == 16) /* and
so on */ );
}