Fix unsigned int conversion to/from Variant

This commit is contained in:
Ruslan Mustakov 2019-12-23 20:53:13 +07:00
commit d1b82d351c
2 changed files with 6 additions and 2 deletions

View file

@ -1,4 +1,4 @@
version = "0.7.25" version = "0.7.26"
author = "Xored Software, Inc." author = "Xored Software, Inc."
description = "Godot Engine bindings" description = "Godot Engine bindings"
license = "MIT" license = "MIT"

View file

@ -604,7 +604,11 @@ proc fromVariant*[T: SomeSignedInt or SomeUnsignedInt](
else: uint64) else: uint64)
intVal = when T is SomeSignedInt: val.asInt() intVal = when T is SomeSignedInt: val.asInt()
else: val.asUint() else: val.asUint()
if intVal > high(T) or intVal < low(T): const highT = when T is SomeSignedInt: high(T).int64
else: high(T).uint64
const lowT = when T is SomeSignedInt: low(T).int64
else: low(T).uint64
if intVal > highT or intVal < lowT:
result = ConversionResult.RangeError result = ConversionResult.RangeError
else: else:
self = T(intVal) self = T(intVal)