From 1afca349cc91beebe7fd04260e0f9e9dbf85eb06 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 25 Apr 2022 21:03:10 +0100 Subject: [PATCH] use shift-and-or rather than mul-and-add in construction of 64-bit from 2x32-bit --- openpower/sv/biginteger/divmnu64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpower/sv/biginteger/divmnu64.c b/openpower/sv/biginteger/divmnu64.c index 52e70a116..c77d9b780 100644 --- a/openpower/sv/biginteger/divmnu64.c +++ b/openpower/sv/biginteger/divmnu64.c @@ -98,9 +98,9 @@ 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 * b + u[j]); + uint64_t dig2 = (k << 32 ) | u[j]; q[j] = dig2 / v[0]; // divisor here. - k = dig2 % v[0]; // modulo bak into next loop + k = dig2 % v[0]; // modulo back into next loop } if (r != NULL) r[0] = k; -- 2.30.2