Hacker News new | ask | show | jobs
by amelius 3412 days ago
In two's complement arithmetic, you are basically computing modulo N (N = 2 to the power of the number of bits). So overflow will not interfere with the swap operation.