在MIPS中向左移动 [英] Shifting left in MIPS
本文介绍了在MIPS中向左移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在方法一中,我想将要转移的数字存储在$ a0内部(例如5位),并且我想将$ t9转移5位,但是我遇到了麻烦.有人知道为什么吗?
In my method one, I have the number that I want to shift by stored inside $a0 (e.g. 5 bits), and I want to shift $t9 by 5 bits, but I'm running into a bit of trouble. Does anyone know why?
MethodOne:
sw $a0, ($t8)
sll $t9, $t9, $t8
推荐答案
要向左移动可变量,请使用sllv
:
To shift left by a variable amount, use sllv
:
sllv $t9, $t9, $a0
sll
仅占用立即移位量.不需要sw
或$t8
.
sll
only takes an immediate shift amount. There is no need for sw
or $t8
.
这篇关于在MIPS中向左移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文