Subtraction is addition in disguise
Micro-lessons
A CPU has an adder but no subtractor. It doesn’t need one: with two’s complement, a − b is just a + (−b), and −b costs one bit-flip and one increment.
A register is a clock
An n-bit register holds 2ⁿ values on a ring: count past the top and you wrap back to zero, exactly like a clock striking 12. Two’s complement reads the top half of the ring as negative — so the same bit pattern that means “large positive” to an unsigned reader means “small negative” to a signed one.
Why flip-and-add-one is negation
Flip every bit of x and you get 2ⁿ − 1 − x (because x + ~x is all ones). Add 1 and you have 2ⁿ − x — which on the ring is the same position as −x. That’s the whole trick: −x = ~x + 1. Walk it on the wheel:
- flip b ~0101 = 1010
- +1 → −b 1010 + 1 = 1011 (= -5)
- a + (−b) 0011 + 1011 = 1110
- keep n bits → 1110 (reads as -2)
Same adder, no subtract circuit: a + (~b + 1) walks around the ring to a − b = -2.
Adding 2ⁿ − b instead of subtracting b lands on the same spot, because going almost all the way around the ring is the same as stepping back a little. Reading the top half as negative makes that wrapped value literally equal −b. No second circuit, no special case for negatives.
What falls out for free
Comparison is just subtraction and a sign check. There is exactly one zero (sign-magnitude wastes a −0). And overflow has a crisp meaning: it’s the moment a sum crosses the seam between +max and −min at the bottom of the ring. That single, uniform scheme is why essentially every processor made since the 1970s stores signed integers this way.
Say it, don’t just nod
In 4-bit two’s complement, what bit pattern is −1 — and what does 0111 + 0001 (7 + 1) give?
−1: flip 0001 → 1110, add 1 → 1111. All ones is always −1 (one step counter-clockwise from zero).
0111 + 0001 = 1000, which reads as −8, not +8 — you landed exactly on the overflow seam. The arithmetic is correct mod 16; the signed interpretation is what overflowed.