Closed konsumlamm closed 2 years ago
Example:
import bigints echo toSignedInt[int64](-initBigInt(0xFFFFFFFF_00000000'u64))
This currently prints some(-9223372036854775808), but the expected result is none(int64).
some(-9223372036854775808)
none(int64)
The reason is the following lines: https://github.com/nim-lang/bigints/blob/18e389928c2875d86e3697cd5997612497e2a2df/src/bigints.nim#L817-L819 This is only correct if x.limbs[1] == uint32.high shr 1 + 1, otherwise x is out of range.
x.limbs[1] == uint32.high shr 1 + 1
x
Example:
This currently prints
some(-9223372036854775808)
, but the expected result isnone(int64)
.The reason is the following lines: https://github.com/nim-lang/bigints/blob/18e389928c2875d86e3697cd5997612497e2a2df/src/bigints.nim#L817-L819 This is only correct if
x.limbs[1] == uint32.high shr 1 + 1
, otherwisex
is out of range.