Mathematically, you do not add signed or unsigned number. There are only values modulo 232 (assuming that you have 32-bit registers). Such values cover a range of 232 consecutive integers, but you are free to interpret that range as beginning just about anywhere. "Signed" and "unsigned" are just two such interpretations.
In other words, with 4-bit registers, the unsigned interpretation of "1011" is eleven, while the signed interpretation is minus-five. But there is only one value (which mathematicians usually call "eleven modulo 24" because mathematicians are traditionally fond of unsigned interpretation). For instance, if you add "0110" to that value (which is "six" in both signed and unsigned interpretations), then you get "0001", which is the proper value: minus-five plus six yield one, and eleven plus six is seventeen which is also equal to one when reduced modulo 24 (seventeen is one plus sixteen; "reducing modulo 24" is about dividing by sixteen [that's 24] and keeping the remainder only).
另一种说法是:数值的(二进制)位数在概念上向左无限。 CPU寄存器只保留最右32位。按照惯例,无符号解释是假设所有最左边的位都为零。按照惯例,有符号解释是假设所有最左边的位都具有与位 31 相同的值(即全部为零,或全部为 1)。无论哪种方式,当您执行加法(或减法或乘法)时,进位从右到左传播,而不是相反,因此这些被忽略的位的值对 32 位结果没有任何影响。因此只有一个“add”操作码,它丝毫不关心其操作数在程序员的大脑中是“有符号”还是“无符号”。
Signedness must be taken into account when performing an operation which is not compatible with modulo arithmetics. Conversion into a sequence of decimal digits for display is such an operation. A more frequent case, however, is comparisons. Values modulo 232 are not ordered; they are in a kind of cyclic loop (when you add 1 to 232-1, and reduce modulo 232, you get back to 0). Comparisons make sense only when you consider integers in the whole range of integers. At that point, you must decide whether you use the signed or unsigned interpretation. Which is why x86 processors offer both jg
(jump if greater, signed interpretation) and ja
(jump if above, unsigned interpretation).