count the number of bit 1 in a integer stackoverflow Hamming weight
n & (n - 1)
Is Power of 2
A non-negative binary integer value x is a power of 2 iff (x&(x-1)) is 0 using 2's complement arithmetic.
Position of least significant bit that is set stackoverflow
Reference:
Bit Twiddling Hacks link