fixes related to Nim v1.0.2 32 bit type inference rule modification

This commit is contained in:
andri lim 2019-10-19 16:56:18 +07:00
parent 9993b9dca4
commit 6eb7b7054e
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 5 additions and 1 deletions

View File

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

View File

@ -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":