From: Jacob Lifshay Date: Fri, 22 Apr 2022 02:05:13 +0000 (-0700) Subject: fix bug X-Git-Tag: opf_rfc_ls005_v1~2627 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0bdf6ee415079d8b9941ff8468dd864c77baef3f;p=libreriscv.git fix bug --- diff --git a/openpower/sv/biginteger/mulmnu.c b/openpower/sv/biginteger/mulmnu.c index 4c6bb8617..0326a154d 100644 --- a/openpower/sv/biginteger/mulmnu.c +++ b/openpower/sv/biginteger/mulmnu.c @@ -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; }