• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

4 Lines ASM need help!

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

NookieN

Member
Joined
Jul 14, 2002
Location
The West
If I remember MIPS correctly...

-Shift-left t0 by 8 bits and store in t1
-Shift-left t0 by 2 bits and store in t2

t1 should now have 256 * t0 and t2 has 4 * t0

-Add t1 and t2 and store in t3

t3 now has 260 * t0

-Add t3 and t0 and store in t0

t0 now has 261 * t0's original value
 

XWRed1

Senior Member
Joined
Oct 31, 2001
The point of using shifts rather than multiplies is that they are faster than multiplies. Only problem is you can only use them to multiply by a base 2 number, iirc.

On x86 at least, a multiply is supposed to be a loop of addition. So it could use alot of cycles. While shifting is just shoving a few bits around.