mirror of
https://github.com/status-im/nim-stint.git
synced 2025-02-16 08:57:18 +00:00
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:
commit
55dcea15e6
@ -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
|
||||
|
||||
|
@ -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":
|
||||
|
Loading…
x
Reference in New Issue
Block a user