News for hackers. Stuff that matters.
Re:The Three Ways of XOR by mcintyre1994 on Monday February 13, 2017 @09:07AM (#13635250)
a = a + b

b = a - b

a = a - b

I think this works too, assuming a+b doesn't overflow.

Re:The Three Ways of XOR by amelius on Monday February 13, 2017 @09:28AM (#13635396)
Good one.

> I think this works too, assuming a+b doesn't overflow.

Well, in two's complement arithmetic (as is used on most architectures), the intermediate overflow can be ignored, and it will work just fine.