summaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/bigint.myr8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/std/bigint.myr b/lib/std/bigint.myr
index cbabe0f..c13f0df 100644
--- a/lib/std/bigint.myr
+++ b/lib/std/bigint.myr
@@ -234,6 +234,12 @@ const bigparse = {str
var val : int, base
var v, b
var a
+ var s = 1
+
+ if hasprefix(str, "-")
+ s = -1
+ str = str[1:]
+ ;;
if hasprefix(str, "0x") || hasprefix(str, "0X")
base = 16
@@ -271,7 +277,7 @@ const bigparse = {str
if val == 0
v.sign = 0
else
- v.sign = 1
+ v.sign = s
;;
bigmul(a, b)
bigadd(a, v)