This should be easy for C++ people though. But I was asked how to do it in C#. Shouldnt be much of difference.
How to find out if a long variable has only one bit set?
I cant think anything except some brutal force shifting all bits and counting whats set.
Powers of 2 would mean a single bit is set.
http://aggregate.org/MAGIC/#Is%20Power%20of%202
EDIT:
To allow for the zero case: