I was at IT company on testing for free C++ courses and I had this task: make one-line function to test value for being power of two.
I was surprised that I soloved this. I think solution looks very interesting for share it ;D
return ( v | (v - 1)) == ( v + (v - 1));

Add Comment