在MIPS中,有符号加法,无符号加法,有符号减法和无符号减法之间有什么区别?
add rd, rs, rt
addu rd, rs, rt
sub rd, rs, rt
subu rd, rs, rt
在MIPS中,有符号加法,无符号加法,有符号减法和无符号减法之间有什么区别?如果它们的结果相同,那么将其分类为使用有符号和无符号方法又有什么意义呢?
In MIPS, what's the difference between signed addition, unsigned addition, signed subtraction and unsigned subtraction? If their results are the same, what's the point to classified as using signed and unsigned methods?
u
只是意味着它们不会在溢出时被捕获.
The u
simply means that they don't trap on overflow.
引自程序员的MIPS32体系结构第II卷":
Quoting from "MIPS32 Architecture For Programmers Volume II":
指令名称中的"unsigned"一词用词不当;此操作是32位模运算,不会在溢出时捕获.该指令适用于无符号算术(例如地址算术)或忽略溢出的整数算术环境(例如C语言算术).
The term "unsigned" in the instruction name is a misnomer; this operation is 32-bit modulo arithmetic that does not trap on overflow. This instruction is appropriate for unsigned arithmetic, such as address arithmetic, or integer arithmetic environments that ignore overflow, such as C language arithmetic.