3 ms·
1110 + 1111 = 1101 1101 - 1110 = 1111 1101 - 1111 = 1110 Overflow doesn't matter if you just want to swap.
by jonsen 10y ago
1110 + 1111 = 1101
1101 - 1110 = 1111
1101 - 1111 = 1110
Overflow doesn't matter if you just want to swap.
- Sacho 10y ago(Assuming two's complement arithmetic, as amelius pointed out - I don't know if all programming languages and platforms use it)
- mcintyre1994 10y agoThat's a really smart observation I hadn't made, thanks for explaining!