fix 32-bit

This commit is contained in:
Jacek Sieka 2023-05-24 17:55:53 +02:00
parent 422b1540de
commit e9b227758e
No known key found for this signature in database
GPG Key ID: A1B09461ABB656B8
2 changed files with 1 additions and 3 deletions

View File

@ -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] =

View File

@ -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)