Proving this Bitwise Property

Правка en1, от -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?

Теги bitwise

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский -synx- 2017-03-10 05:38:59 254 Initial revision (published)