Hacker News new | ask | show | jobs
by StevenXC 747 days ago
Algebraically, where | denotes concatenation, and z is a string of 0s:

x = y | 1 | z

-x = ~x + 1

-x = (~y | 0 | ~z) + 1

-x = ~y | 1 | z

x & -x = (y & ~y) | (1 & 1) | (z & z)

x & -x = 0 | 1 | z