From 6eb7b7054e4938de4688317799de08bed7b0f6c8 Mon Sep 17 00:00:00 2001 From: andri lim Date: Sat, 19 Oct 2019 16:56:18 +0700 Subject: [PATCH] fixes related to Nim v1.0.2 32 bit type inference rule modification --- stint/private/uint_mul.nim | 2 +- tests/test_uint_muldiv.nim | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/stint/private/uint_mul.nim b/stint/private/uint_mul.nim index 4554c11..f933231 100644 --- a/stint/private/uint_mul.nim +++ b/stint/private/uint_mul.nim @@ -19,7 +19,7 @@ import macros, func lo(x: uint64): uint64 {.inline.} = const p: uint64 = 32 - base: uint64 = 1 shl p + base: uint64 = 1'u64 shl p mask: uint64 = base - 1 result = x and mask diff --git a/tests/test_uint_muldiv.nim b/tests/test_uint_muldiv.nim index 5db8ff3..629f95c 100644 --- a/tests/test_uint_muldiv.nim +++ b/tests/test_uint_muldiv.nim @@ -32,6 +32,10 @@ suite "Testing unsigned int multiplication implementation": check: cast[uint64](a*b*c) == 1_000_000_000_000_000_000_000'u64 # need 70-bits + test "Nim v1.0.2 32 bit type inference rule changed": + let x = 9975492817.stuint(256) + let y = 16.stuint(256) + check x * y == 159607885072.stuint(256) suite "Testing unsigned int division and modulo implementation": test "Divmod(100, 13) returns the correct result":