We know from school that a - b = a + (-b). And thatβs how we do not subtract logic, add a negative one. We also know, starting with the beginning programming classes, that with two additions, in order to get negative, you invert and add one. a - b = a + (~ b) + 1. We also know the concept of transfer from the school class. 9 + 3 = 2. The same thing in binary format, with two operands, you can have 1 + 1 = 0. Therefore, each column in the logic needs to be carried. Each of them consists of three bits in two bits, two operands plus transfer and carry out and result. Since each of these logic blocks has an input bit that carries, the normal addition that first carries is zero, but for subtraction we can do this transfer to 1 and invert the second operand to get a + b = a + (~ b) + one
Thus, subtraction is a complement if you work with a few simple examples, or it is better to try each three-bit combination of operands yourself. You will see that there is no such thing as signed or unsigned addition (or subtraction), the beauty of coding with two additions.
Knowing all this, subtraction is a complement, with the addition we get execution at UNSIGNED overflow, the overflow bit is signed when the transfer and execution of msbit do not match, usually presented as flag V. Now some architectures, since they already invert operand b on the path and on the way, they invert the execution on the output. SOME DEBT. Therefore, you need to take a look at your specific architecture to see if this overflow is running without an inscription or if it is an activity. or not to borrow or something else.
zero minus something will not always be done to add.
0b000 - 0b111 0001 000 + 000
The completion of the addition is zero. Your architecture may prefer to leave it that way, or it may choose to invert it and name it a loan.
Inside the architecture family. All x86 or all ARMs are likely to continue to do the same forever. But there is no reason to expect that ARM and MIPS and x86 and XYZ will do everything the same.
Inverting and defining it as a loan makes sense in terms of terminology.
Please note that all (signed / unsigned) values ββare greater than, greater than or equal to, less than or equal to, are based on the choice of carry / borrow for this architecture, you cannot translate these flag comparisons by architectures if they have the same definition.