From d1b82d351c81243670694e6f79d584ac7b837106 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Mon, 23 Dec 2019 20:53:13 +0700 Subject: [PATCH] Fix unsigned int conversion to/from Variant --- godot.nimble | 2 +- godot/nim/godotnim.nim | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/godot.nimble b/godot.nimble index 1ad646b..7115536 100644 --- a/godot.nimble +++ b/godot.nimble @@ -1,4 +1,4 @@ -version = "0.7.25" +version = "0.7.26" author = "Xored Software, Inc." description = "Godot Engine bindings" license = "MIT" diff --git a/godot/nim/godotnim.nim b/godot/nim/godotnim.nim index 4d577cc..7b0a832 100644 --- a/godot/nim/godotnim.nim +++ b/godot/nim/godotnim.nim @@ -604,7 +604,11 @@ proc fromVariant*[T: SomeSignedInt or SomeUnsignedInt]( else: uint64) intVal = when T is SomeSignedInt: val.asInt() 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 else: self = T(intVal)