fix UB caused by lkcl in 1afca349cc91beebe7fd04260e0f9e9dbf85eb06
authorJacob Lifshay <programmerjake@gmail.com>
Tue, 26 Apr 2022 06:16:55 +0000 (23:16 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Tue, 26 Apr 2022 06:16:55 +0000 (23:16 -0700)
openpower/sv/biginteger/divmnu64.c

index 8783f8d1a65c59f0fbd4e0546e9940474721e06a..0d3f3973ac19708e4d274dcba8e473fd30df8d79 100644 (file)
@@ -98,7 +98,7 @@ int divmnu(unsigned q[], unsigned r[], const unsigned u[], const unsigned v[],
         k = 0; // the case of a
         for (j = m - 1; j >= 0; j--)
         { // single-digit
-            uint64_t dig2 = (k << 32) | u[j];
+            uint64_t dig2 = ((uint64_t)k << 32) | u[j];
             q[j] = dig2 / v[0]; // divisor here.
             k = dig2 % v[0];    // modulo back into next loop
         }