fix bug
authorJacob Lifshay <programmerjake@gmail.com>
Fri, 22 Apr 2022 02:05:13 +0000 (19:05 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Fri, 22 Apr 2022 02:05:13 +0000 (19:05 -0700)
openpower/sv/biginteger/mulmnu.c

index 4c6bb861703f1e87709e6658a44a9625e2d6840c..0326a154d12a76730b03642f23e9c7fe39de5eab 100644 (file)
@@ -30,13 +30,13 @@ void mulmnu(unsigned short w[], unsigned short u[], unsigned short v[], int m,
         unsigned short plo[2000];
         for (i = 0; i < m; i++)
         {
-            unsigned product = u[i] * v[j] + w[i + j];
+            unsigned product = (unsigned)u[i] * v[j] + w[i + j];
             phi[i] = product >> 16;
             plo[i] = product;
         }
         for (i = 0; i < m; i++)
         {
-            t = (phi[i] << 16) | plo[i] + k;
+            t = (((unsigned)phi[i] << 16) | plo[i]) + k;
             w[i + j] = t; // (I.e., t & 0xFFFF).
             k = t >> 16;
         }