mirror of
https://github.com/status-im/nim-stint.git
synced 2025-02-16 17:07:23 +00:00
fixes related to Nim v1.0.2 32 bit type inference rule modification
This commit is contained in:
parent
9993b9dca4
commit
6eb7b7054e
@ -19,7 +19,7 @@ import macros,
|
|||||||
func lo(x: uint64): uint64 {.inline.} =
|
func lo(x: uint64): uint64 {.inline.} =
|
||||||
const
|
const
|
||||||
p: uint64 = 32
|
p: uint64 = 32
|
||||||
base: uint64 = 1 shl p
|
base: uint64 = 1'u64 shl p
|
||||||
mask: uint64 = base - 1
|
mask: uint64 = base - 1
|
||||||
result = x and mask
|
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
|
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":
|
suite "Testing unsigned int division and modulo implementation":
|
||||||
test "Divmod(100, 13) returns the correct result":
|
test "Divmod(100, 13) returns the correct result":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user