Fix unsigned int conversion to/from Variant
This commit is contained in:
parent
78d3626fa3
commit
d1b82d351c
2 changed files with 6 additions and 2 deletions
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue