|
Post by Jason777 on Apr 1, 2011 23:13:06 GMT -5
Instead of using the left and right logical bitshifts, couldn't you have used the MUL and DIV opcodes in this order?:
MUL a1, a1, 4 DIV a1, a1, 2
Just curious...
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 2, 2011 7:15:49 GMT -5
That would be better if I wanted to multiply by a number that's not a power of two. Those commands work in a different way though, so it'd have to be something like:
ADDIU a0, r0, 0x0005; a0 = 5 MULT a0, a0; a0*a0 MFLO a0; get result
Since the multiplication/division commands don't take immediate parameters (only registers) and their output is stored in the HI and LO registers.
|
|