XOR=XOR & ~(XOR-1);
example :
xor=7 (0...0111) binary rep
xor-1=6(0...0110)
~(xor-1)=(11....1001)
xor&~(xor-1)=(00....0001) get the right most set bit
example :
xor=7 (0...0111) binary rep
xor-1=6(0...0110)
~(xor-1)=(11....1001)
xor&~(xor-1)=(00....0001) get the right most set bit
No comments:
Post a Comment