about summary refs log tree commit diff stats
path: root/src/utils/twtstr.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r--src/utils/twtstr.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 3cbcfcd3..8171010a 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -230,7 +230,7 @@ func parseIntImpl[T: SomeSignedInt](s: string; allowed: set[char]; radix: T):
     if s[i] notin allowed:
       return none(T) # invalid
     let c = T(hexValue(s[i]))
-    if unlikely(T.high div radix - c < integer):
+    if unlikely((T.high - c) div radix < integer):
       return none(T) # overflow
     integer *= radix
     integer += c
@@ -265,7 +265,7 @@ func parseUIntImpl[T: SomeUnsignedInt](s: string; allowSign: static bool;
     if s[i] notin allowed:
       return none(T) # invalid
     let c = T(hexValue(s[i]))
-    if unlikely(T.high div radix - c < integer):
+    if unlikely((T.high - c) div radix < integer):
       return none(T) # overflow
     integer *= radix
     integer += c