Q7. bitmask power of 2
bool get(int x)
{
return (x && !(x & (x - 1)));
}
Above function will return :-
#can you explain what does this function do?
Bitmasking Quiz Q. 7
It returns one if the number is power of 2 else return 0.
How? Can you please elaborate?
Actually i have considered many numbers and find it by observation.