• ZILtoid1991@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    7 months ago

    it multiplies by using a complex set of gate arrays that do some adding, otherwise hardware multipliers are like multiplier tables built up by logic gates. Early CPUs did multiplication by adding (essentially multiplications are just recursively adding the same numbers to themselves), and if you were lucky it was optimized to use bit-shifts.

    Division is a lot more complicated though. I did some optimization by multiplying with reciprocals instead, but speed gain was negligible due to memory bandwith limitations.