return x == (x & -x);
This answer works because of the way two's complement notation is designed.
First, an example. Assume we have 8-bit signed integers.
00010000 = 16
11110000 = -16
The bitwise and will give you 00010000
as a result, equal to your original value! The reason that this works is because when negating in 2's complement, first invert all the bits, then add 1. You'll have a bunch of zeros and a bunch of carries until a one falls into place. The bitwise and then checks if we have the right bit set.
In the case of a number that isn't a power of two:
00101010 = 42
& 11010110 = -42
----------
00000010 != 42
Your result will still have only a single bit, but it won't match the original value. Therefore your original value had multiple bits set.
Note: This technique returns true for 0, which may or may not be desirable.