From e02bfc916743a0327d76144b32b6ec6381e5907f Mon Sep 17 00:00:00 2001 From: eunhhu Date: Wed, 30 Sep 2026 15:51:32 +0100 Subject: Let a value's 8 bytes hold a number or an integer Before i64 (016 stage 2): a state's value, a record field's default, a list cell's number, the interpreter's stack slot and an instruction's constant become unions of a double and an int64_t (PureValue, anonymous unions in PureCell, Slot and PureOp). LOAD and STORE, and a list cell made from the stack, copy the bits; everything else reads .num as before. No behaviour changes: every check passes as it did. --- core/module-list.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/module-list.c') diff --git a/core/module-list.c b/core/module-list.c index 16511de..20fed2b 100644 --- a/core/module-list.c +++ b/core/module-list.c @@ -130,9 +130,9 @@ static double *numbers(const Layout *l, const Node *leaf, unsigned f) { return ( static PureSpan *texts(const Layout *l, const Node *leaf, unsigned f) { return (PureSpan *)((char *)leaf + l->column[f]); } static PureCell cell_at(const Layout *l, const Node *leaf, unsigned i, unsigned f) { - if (!l->text_fields[f]) return (PureCell){numbers(l, leaf, f)[i], NULL, 0}; + if (!l->text_fields[f]) return (PureCell){.num = numbers(l, leaf, f)[i]}; PureSpan text = texts(l, leaf, f)[i]; - return (PureCell){0, (unsigned char *)text.data, text.size}; + return (PureCell){.text = (unsigned char *)text.data, .size = text.size}; } static void put_cells(const Layout *l, Node *leaf, unsigned i, const PureCell *cells) { @@ -706,7 +706,7 @@ static bool decode_cell(const Layout *l, unsigned field, const unsigned char *by } if (bits > size - *at || (l->text_fields[field] == 1 && !pure_utf8_valid((PureSpan){bytes + *at, (size_t)bits}))) return false; - *cell = (PureCell){0, (unsigned char *)bytes + *at, (size_t)bits}; + *cell = (PureCell){.text = (unsigned char *)bytes + *at, .size = (size_t)bits}; *at += (size_t)bits; return true; } @@ -769,7 +769,7 @@ static bool get_compact(const Layout *l, unsigned field, const unsigned char *by if (l->text_fields[field]) { if (value > size - *at || (l->text_fields[field] == 1 && !pure_utf8_valid((PureSpan){bytes + *at, (size_t)value}))) return false; - *cell = (PureCell){0, (unsigned char *)bytes + *at, (size_t)value}; + *cell = (PureCell){.text = (unsigned char *)bytes + *at, .size = (size_t)value}; *at += (size_t)value; return true; } -- cgit v1.2.3