Abusing the CPU’s Adder Circuits

Abusing the CPU’s Adder Circuits

Let’s write out the truth table for that:

Right, if we’re going to expand this to add numbers with more than one bit, we’re going to need to do something about this carry output. By adding to the input, we’re essentially ensuring that the carry signal is not asserted until we hit the first one bit, but after that it will be asserted for all the rest of the bits (travelling from right to left). If we extract the relevant parts of the adder truth table we can see how the addition operation will produce the mask that we need:

What that gives us is a number which is (from right to left):

Source: giannitedesco.github.io