1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Multiplying in Assembly

Discussion in 'Assembly Language Programming (ALP) Forum' started by dsptl, Jul 1, 2009.

  1. dsptl

    dsptl New Member

    Joined:
    Jun 14, 2009
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    How can you multiply the content of register %o0 by 15 without calling .mul or ading %o0 to itself 15 times in Assembly?
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Shift it left 4 times (equivalent to multiplying by 16) and subtract the original value.

    0x0012 << 4 = 0x0120
    0x0120-0x0012=0x010e=0x0012*0x000f
     
    Last edited: Jul 2, 2009

Share This Page