3 ms·
a = a + b b = a - b a = a - b I think this works too, assuming a+b doesn't overflow.
by mcintyre1994 10y ago
a = a + b
b = a - b
a = a - b
I think this works too, assuming a+b doesn't overflow.
- amelius 10y agoGood 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.