如何在MIPS组装中执行floor和ceil功能? [英] how can do floor and ceil function in MIPS assembly?

查看:146
本文介绍了如何在MIPS组装中执行floor和ceil功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下如何在MIPS汇编中执行floor和ceil函数?

I would like to ask how I can do floor and ceil functions in MIPS assembly??

推荐答案

你一定要得到一些MIPS指令集参考的副本。即便没有,我也可以使用Google找到 floor.s ceil.s 的说明。



但是,只有较新的MIPS CPU才支持这些。但你也可以通过添加或减去0.5(取决于参数和函数的符号)并将结果转换为整数来做到这一点。



谷歌甚至会找到一个地板的例子: https:/ /github.com/jrvidal/goruden-boi/blob/master/lit/cs61c/floor.s.md [ ^ ]。
You should definitely get some copy of the MIPS instruction set reference. Even without that I was able to find the instructions floor.s and ceil.s using Google.

However, these are only supported with newer MIPS CPUs. But you can also do it the hard way by adding or subtracting 0.5 (depening on the sign of the argument and the function) and convert the result to an integer.

And Google will even find an example for floor: https://github.com/jrvidal/goruden-boi/blob/master/lit/cs61c/floor.s.md[^].


这篇关于如何在MIPS组装中执行floor和ceil功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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