在MIPS中,有符号加法,无符号加法,有符号减法和无符号减法之间有什么区别? [英] In MIPS, what's the difference between signed addition, unsigned addition, signed subtraction and unsigned subtraction?

查看:702
本文介绍了在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.

这篇关于在MIPS中,有符号加法,无符号加法,有符号减法和无符号减法之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆