Possible Duplicates:
Query about working out whether number is a power of 2
How to check if a number is a power of 2
I require a function body for this prototype:
bool isPOT(int x);
So it would return eg isPOT(3) = FALSE, but isPOT(8) = TRUE
What is the most pretty/concise algorithm? And what is the most efficient?
PS: I am amazed that I cannot find this question on SO, so I am fully expecting someone to detect some duplicate.
PPS: can someone please create POT, NPOT, Power-Of-Two tags?