summaryrefslogtreecommitdiff
path: root/dat.h
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-07-24 14:44:07 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-07-24 14:44:07 +0000
commit0a706b5b413aa96a944f45f28fb948c62e763555 (patch)
treea6855bf51b7280b14db85320d2e698ddd9db5c3e /dat.h
parentef55dad27294cc01671d3c7b0f8091968dc72884 (diff)
Reduce size of the Term struct from about 72 bytes to 48
Diffstat (limited to 'dat.h')
-rw-r--r--dat.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/dat.h b/dat.h
index d6adb18..b2ae80b 100644
--- a/dat.h
+++ b/dat.h
@@ -18,18 +18,25 @@ struct Operator
Operator *next;
};
-struct Term
+struct Compound
{
- int tag;
-
Rune *text;
int arity;
- Term *next;
Term *children;
- vlong ival;
- double dval;
+};
+
+struct Term
+{
+ u8int tag;
+ u8int inparens;
uvlong clausenr;
- int inparens; /* kinda bad hack needed for the current parser */
+ Term *next;
+
+ union {
+ vlong ival;
+ double dval;
+ struct Compound;
+ };
};
struct Binding