From ca4b2a548b46c09d1a03bc099589fae9317872aa Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 18 Apr 2022 10:38:12 -0700 Subject: [PATCH] split out condition --- openpower/sv/bitmanip/divmnu64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openpower/sv/bitmanip/divmnu64.c b/openpower/sv/bitmanip/divmnu64.c index f9f6572d0..1d3585eec 100644 --- a/openpower/sv/bitmanip/divmnu64.c +++ b/openpower/sv/bitmanip/divmnu64.c @@ -8,6 +8,7 @@ machine which has a 64/64 division instruction. */ #include #include //To define "exit", req'd by XLC. +#include #define max(x, y) ((x) > (y) ? (x) : (y)) @@ -115,9 +116,10 @@ again: } t = un[j+n] - k; un[j+n] = t; + bool need_fixup = t < 0; q[j] = qhat; // Store quotient digit. - if (t < 0) { // If we subtracted too + if (need_fixup) { // If we subtracted too q[j] = q[j] - 1; // much, add back. k = 0; for (i = 0; i < n; i++) { -- 2.30.2