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,009
    Likes Received:
    203
    Trophy Points:
    63
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice