diff options
author | Ori Bernstein <ori@eigenstate.org> | 2014-05-28 00:01:49 -0400 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2014-05-28 00:01:49 -0400 |
commit | c860f5307ff18dff3c63d6a80691c4a865101491 (patch) | |
tree | 892c757477dd25db7b312228835d8f7ef888a25e /libstd/intparse.myr | |
parent | 728fe3286bec3f5e6b6df584d88c6b39e54237cb (diff) | |
download | mc-c860f5307ff18dff3c63d6a80691c4a865101491.tar.gz |
Use a signed int when we check for <0
If we use negative value to signal errors, we had better make
sure that we can hold negative values.
Diffstat (limited to 'libstd/intparse.myr')
-rw-r--r-- | libstd/intparse.myr | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libstd/intparse.myr b/libstd/intparse.myr index 1ea96bd..685c6cd 100644 --- a/libstd/intparse.myr +++ b/libstd/intparse.myr @@ -45,7 +45,8 @@ generic intparsebase = {s, base generic doparse = {s, isneg, base var c - var v, cv + var v + var cv : int32 v = 0 while s.len != 0 @@ -56,7 +57,7 @@ generic doparse = {s, isneg, base cv = charval(c, base) if cv >= 0 v *= (base castto(@a::(integral,numeric))) - v += cv + v += cv castto(@a::(integral,numeric)) else -> `None ;; |