msp4th: */ now returns a single 16b result
authorDan White <dan@whiteaudio.com>
Fri, 10 May 2013 21:28:46 +0000 (16:28 -0500)
committerDan White <dan@whiteaudio.com>
Fri, 10 May 2013 21:28:46 +0000 (16:28 -0500)
Also, cleanup unnecessary casts.

msp4th/msp4th.c

index 0b5e712bf0b1af36f5faca3681a302246a1af488..2c8624ac16825ab8d099399a7698db2f1600cae7 100644 (file)
@@ -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;