commit 9e0a6d84479539d84cfbb73ddb0e19b97858e1bc
parent f75845357147c3985a5bd7444900e14a639f775e
Author: Kirill Primak <vyivel@eclair.cafe>
Date: Wed, 13 Jul 2022 11:36:05 +0300
strconv: fix mulshiftall64()
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/strconv/ftos.ha b/strconv/ftos.ha
@@ -94,7 +94,7 @@ fn mulshift64(m: u64, mul: (u64, u64), j: u32) u64 = {
fn mulshiftall64(m: u64, mul: (u64, u64), j: i32, mm_shift: u32) (u64, u64, u64) = {
m <<= 1;
const r0 = u128mul(m, mul.0), r1 = u128mul(m, mul.1);
- const lo = r0.lo, tmp = r0.hi, mid = r1.lo;
+ const lo = r0.lo, tmp = r0.hi, mid = tmp + r1.lo;
const hi = r1.hi + ibool(mid < tmp);
const lo2 = lo + mul.0;
const mid2 = mid + mul.1 + ibool(lo2 < lo);