我刚开始学习 MIPS 指令的异常处理程序。
我需要让我的程序有算术溢出异常,以便我可以测试我的异常处理程序。
我有两个数组 A 和 B。数组 A 有十六进制数,数组 B 有整数。
如何通过添加十六进制数和整数来溢出?
哪个十六进制数和整数相加会导致溢出?
最佳答案
根据MIPS instruction reference ,唯一能产生溢出异常的加法运算是有符号加法指令:
ADD
ADDI
# Load 2147483647 into $s1
LUI $s0, 32767
ORI $s1, $s0, 65535
# Add 1 to $s1 and store in $s2. This should produce an overflow exception
ADDI $s2, $s1, 1
https://stackoverflow.com/questions/23234189/
相关文章:
installation - NSIS:MUI_PAGE_INSTFILES 完成后如何自动按下 "
vb.net - MeasureText() - SizeF 到英寸
applescript - 如何使用 AppleScript 关闭 MS Office Ribbon
cordova - 在 Windows Phone 8 中调用日期时间选择器插件
sql - MSSQL : Display Rows for a Select with Case
ckeditor - 如何从内联 CKEditor 的可编辑区域中删除边框?
amazon-web-services - boto如何选择aws区域来创建buckets?
ruby-on-rails - 在 current_password 字段中设计更改验证消息