All pastes #602105 Raw Edit

Jemand

public text v1 · immutable
#602105 ·published 2007-07-03 21:54 UTC
rendered paste body
    static inline int32_t fixmul32(int32_t x, int32_t y)
    {
        int32_t t1;
        asm (
            "mac.l   %[x], %[y], %%acc0  \n" /* multiply */
            "mulu.l  %[y], %[x]      \n"     /* get lower half, avoid emac stall */
            "movclr.l %%acc0, %[t1]  \n"     /* get higher half */
            "lsr.l   #1, %[t1]       \n"
            "move.w  %[t1], %[x]     \n"
            "swap    %[x]            \n"
            : /* outputs */
            [t1]"=&d"(t1),
            [x] "+d" (x)
            : /* inputs */
            [y] "d"  (y)
        );
        return x;
    }