In my method one, I have the number that I want to shift by stored inside $a0 (eg 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
To shift left by a variable amount, use sllv
:
sllv $t9, $t9, $a0
sll
only takes an immediate shift amount. There is no need for sw
or $t8
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.