From e9b227758e6e24deb733d3914067f34ec09dfdee Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Wed, 24 May 2023 17:55:53 +0200 Subject: [PATCH] fix 32-bit --- stew/intops.nim | 2 +- tests/test_intops.nim | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/stew/intops.nim b/stew/intops.nim index 2cdbc5e..f706def 100644 --- a/stew/intops.nim +++ b/stew/intops.nim @@ -109,7 +109,7 @@ func mulWiden*(x, y: uint): tuple[lo, hi: uint] = when sizeof(uint) == sizeof(uint64): let (a, b) = mulWiden(uint64(x), uint64(y)) else: - let (a, b) = mulWiden(uint32(x), uint64(y)) + let (a, b) = mulWiden(uint32(x), uint32(y)) (uint(a), uint(b)) func mulWiden*(x, y, carry: SomeUnsignedInt): tuple[lo, hi: SomeUnsignedInt] = diff --git a/tests/test_intops.nim b/tests/test_intops.nim index d2d8ec7..077a61b 100644 --- a/tests/test_intops.nim +++ b/tests/test_intops.nim @@ -42,8 +42,6 @@ template testMulWiden[T: SomeUnsignedInt]() = doAssert mulWiden(T(2), T(2)) == (T(4), T(0)) doAssert mulWiden(T.high, T(1)) == (T.high, T(0)) doAssert mulWiden(T(1), T.high) == (T.high, T(0)) - echo mulWiden(T.high, T.high) - echo T.high doAssert mulWiden(T.high, T.high) == (T(1), T.high - 1) doAssert mulWiden(T.high, T.high, T(0)) == (T(1), T.high - 1)