diff options
| author | eunhhu <[email protected]> | 2026-09-30 15:51:32 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-30 15:51:32 +0100 |
| commit | e02bfc916743a0327d76144b32b6ec6381e5907f (patch) | |
| tree | faf17d43c373e322c5b55ae8adc680d09bd49b4c /core/module-list.c | |
| parent | ee21aec10726863d8e812643e1419e4b7d0f2b51 (diff) | |
| download | pure-e02bfc916743a0327d76144b32b6ec6381e5907f.tar.gz pure-e02bfc916743a0327d76144b32b6ec6381e5907f.zip | |
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.
Diffstat (limited to 'core/module-list.c')
| -rw-r--r-- | core/module-list.c | 8 |
1 files changed, 4 insertions, 4 deletions
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; } |
