commit a4b136df514a55da0d24a72ca3fff3c3a71ec22c
parent 8c7b95b7793e10bdb0cbfb4a71985e2fc78a9d08
Author: erai <erai@omiltem.net>
Date: Sat, 15 Feb 2025 22:27:31 +0000
make table compile
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bootstrap.sh b/bootstrap.sh
@@ -2,7 +2,7 @@
BOOTSTRAP="cc0.c"
LIBS="bufio.om lib.om alloc.om syscall.om"
-SOURCES="cc1.om type.om parse2.om peglib.om as.om decl.om node.om peg.om ir.om ircout.om rb.om"
+SOURCES="cc1.om type.om parse2.om peglib.om as.om decl.om node.om peg.om ir.om ircout.om rb.om table.om"
# Build the bootstrap compiler from c
[ cc0 -nt cc0.c ] || gcc -std=c89 ${BOOTSTRAP} -o cc0
diff --git a/table.om b/table.om
@@ -13,7 +13,7 @@ struct table {
}
func thash(x: int): int {
- return x * 0x9e3779b97f4a7c15;
+ return x * -0x61c8864680b583eb;
}
func tcreate(a: *alloc): *table {
@@ -37,7 +37,7 @@ func trehash(t: *table, cap: int) {
var i: int;
table = t.table;
- t.table = alloc(t.a, cap * sizeof(*table));
+ t.table = alloc(t.a, cap * sizeof(*table)) as *tentry;
len = t.cap;
i = 0;
@@ -113,7 +113,7 @@ func tset(t: *table, x: int, y: int) {
if t.cap == 0 {
t.cap = 16;
- t.table = alloc(t.a, t.cap * sizeof(*t.table));
+ t.table = alloc(t.a, t.cap * sizeof(*t.table)) as *tentry;
}
e = tfind(t, x);