summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2019-06-07 21:28:53 -0400
committerS. Gilles <sgilles@math.umd.edu>2019-06-07 21:28:53 -0400
commiteff0ab25c1d542934e1a5d9df45da403777dd3c6 (patch)
treef712d73a47fe739b70ba797fc41f67d11b18ca5a
parent3e9fc44da6d6f27d911211d6b8fbced97c0b4812 (diff)
parentfd333ef7321e70c49b97d9ffb47805fe686e5d05 (diff)
downloadmc-eff0ab25c1d542934e1a5d9df45da403777dd3c6.tar.gz
Merge remote-tracking branch 'origin/master' into pown-impl
-rw-r--r--lib/std/bigint.myr2
-rw-r--r--lib/std/test/bigint.myr6
-rw-r--r--parse/export.c7
-rw-r--r--parse/parse.h1
4 files changed, 11 insertions, 5 deletions
diff --git a/lib/std/bigint.myr b/lib/std/bigint.myr
index 7b0f4bc..478d9fc 100644
--- a/lib/std/bigint.myr
+++ b/lib/std/bigint.myr
@@ -109,7 +109,7 @@ generic mkbigint = {v : @a :: integral,numeric @a
;;
val = (v : uint64)
slpush(&a.dig, (val : uint32))
- if val > Base
+ if val >= Base
slpush(&a.dig, (val/Base : uint32))
;;
-> trim(a)
diff --git a/lib/std/test/bigint.myr b/lib/std/test/bigint.myr
index 2467143..c87f1f3 100644
--- a/lib/std/test/bigint.myr
+++ b/lib/std/test/bigint.myr
@@ -27,7 +27,7 @@ const main = {
}
const smoketest = {ct
- var a, b, c, d, e
+ var a, b, c, d, e, f
var buf : byte[64], n
/* a few combined ops */
@@ -36,6 +36,7 @@ const smoketest = {ct
c = std.mkbigint(7919)
d = std.mkbigint(113051)
e = std.mkbigint(11)
+ f = std.mkbigint((4294967296 : int64))
std.bigmul(a, b)
std.bigmul(a, b)
@@ -50,6 +51,9 @@ const smoketest = {ct
n = std.bigbfmt(buf[:], a, 0)
testr.check(ct, std.eq(buf[:n], "517347321949036993306"), "simple smoke test failed")
+
+ n = std.bigbfmt(buf[:], f, 0)
+ testr.check(ct, std.eq(buf[:n], "4294967296"), "smoke test failed for 2^32 case")
}
const matchsmall = {c
diff --git a/parse/export.c b/parse/export.c
index f907ceb..fb7b05f 100644
--- a/parse/export.c
+++ b/parse/export.c
@@ -15,8 +15,8 @@
#include "util.h"
#include "parse.h"
-static void tagtype(Stab *st, Type *t, int ingeneric, int hidelocal);
static void tagnode(Stab *st, Node *n, int ingeneric, int hidelocal);
+static void tagtype(Stab *st, Type *t, int ingeneric, int hidelocal);
void
tagreflect(Type *t)
@@ -71,9 +71,10 @@ tagtype(Stab *st, Type *t, int ingeneric, int hidelocal)
{
size_t i;
- if (!t || t->vis != Visintern)
+ if (!t || t->tagged)
return;
- t->vis = Vishidden;
+ t->tagged = 1;
+ t->vis = (t->vis == Visintern) ? Vishidden : t->vis;
tagtype(st, t->seqaux, ingeneric, hidelocal);
for (i = 0; i < t->nsub; i++)
tagtype(st, t->sub[i], ingeneric, hidelocal);
diff --git a/parse/parse.h b/parse/parse.h
index 619f9d6..4fbbfa7 100644
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -169,6 +169,7 @@ struct Type {
char isemitted; /* Tyname: whether this type has been emitted */
char resolved; /* Have we resolved the subtypes? Prevents infinite recursion. */
char fixed; /* Have we fixed the subtypes? Prevents infinite recursion. */
+ char tagged; /* Have we tagged the type for export? */
};