From: Dan White Date: Fri, 10 May 2013 21:28:46 +0000 (-0500) Subject: msp4th: */ now returns a single 16b result X-Git-Tag: cheetah~97 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=aae66c791356f9fd45f2f382cc03c066d55838c2;p=430.git msp4th: */ now returns a single 16b result Also, cleanup unnecessary casts. --- diff --git a/msp4th/msp4th.c b/msp4th/msp4th.c index 0b5e712..2c8624a 100644 --- a/msp4th/msp4th.c +++ b/msp4th/msp4th.c @@ -1172,23 +1172,23 @@ void execN(int16_t opcode){ popMathStack(); break; - case 54: // */ ( a b c -- reshi reslo ) \ (a*b)/c scale function + case 54: // */ ( a b c -- (a*b)/c ) \ 32b intermediate #if defined(MSP430) asm("dint"); MPYS = popMathStack(); OP2 = NOS; - x = (int32_t)(((int32_t)RESHI << 16) | RESLO); - x = (int32_t)(x / TOS); - NOS = (int16_t)((x >> 16) & 0xffff); + x = (((int32_t)RESHI << 16) | RESLO); + x = (x / TOS); + popMathStack(); TOS = (int16_t)(x & 0xffff); asm("eint"); #else i = popMathStack(); j = TOS; k = NOS; - x = (int32_t)(j * k); - x = (int32_t)(x / i); - NOS = (int16_t)((x >> 16) & 0xffff); + x = j * k; + x = x / i; + popMathStack(); TOS = (int16_t)(x & 0xffff); #endif break;