We know in order to get the lowest set bit of a number we do X &= -X . That is in fact a condensed form of X &= ~(X - 1) . What I don't get here is how ~(X - 1) == -X ?
I can get to the answer using a truth table easily but I'm looking for a Boolean Algebra type of proof.