ref: eff0ab25c1d542934e1a5d9df45da403777dd3c6
parent: 3e9fc44da6d6f27d911211d6b8fbced97c0b4812
parent: fd333ef7321e70c49b97d9ffb47805fe686e5d05
author: S. Gilles <[email protected]>
date: Fri Jun 7 17:28:53 EDT 2019
Merge remote-tracking branch 'origin/master' into pown-impl
--- a/lib/std/bigint.myr
+++ b/lib/std/bigint.myr
@@ -109,7 +109,7 @@
;;
val = (v : uint64)
slpush(&a.dig, (val : uint32))
- if val > Base
+ if val >= Base
slpush(&a.dig, (val/Base : uint32))
;;
-> trim(a)
--- a/lib/std/test/bigint.myr
+++ b/lib/std/test/bigint.myr
@@ -27,7 +27,7 @@
}
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 @@
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 @@
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
--- 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 @@
{
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);
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -169,6 +169,7 @@
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? */
};