Merge pull request #93 from jangko/fix_mul_op

fixes related to Nim v1.0.2 32 bit type inference rule modification
This commit is contained in:
andri lim 2019-10-20 13:45:33 +07:00 committed by GitHub
commit 55dcea15e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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":