Proving this Bitwise Property

Revision en1, by -synx-, 2017-03-10 05:38:59

How can we prove that
i - (i& - i) = i&(i - 1)
mathematically?
Obviously, we can realise that i&(i - 1) unsets the LSB, and (i& - i) gives the LSB (subtracting which, also unsets the LSB). Is there a more concrete backing?

Tags bitwise

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English -synx- 2017-03-10 05:38:59 254 Initial revision (published)