Binary addition all boils down to one plus one is two:
1 + 1 = 10
Think of the nerdy T-shirt:
Once we master 1 + 1
,
binary arithmetic has a pretty simple addition table.
+| 0 1 -+------- 0| 0 1 1| 1 10
Here is an application of our addition table.
The c
s indicate carries into
that bit position. It works just like elementary school arithmetic.
cc 01100100 100 + 00001101 + 13 ---------- ---- 01110001 113
Remeber the mantra, "six plus seven is three, carry the one"? In binary, we have, "one plus one is zero, carry the one".
We do a lot of carrying in binary addition. It's tedious when computing by hand, but electronic circuits handle it easily. When the sum of two bytes leads to a carry out of the leftmost bit, that bit is lost to the byte forever. Most computer processors will save it in a special Carry bit, in case the code running wants to check for it.