In the final version of x&(x-1)==0, one part was overlooked- negative numbers :)
Take the modulus and do the bitwise check!
Take the modulus and do the bitwise check!
If you go by the Two's complement representation, then for a negative number say (-8), because of sign extention, a check for x&(x-1) would fail.