diff options
| author | Taylan Kammer <taylan.kammer@gmail.com> | 2026-07-27 07:11:46 +0200 |
|---|---|---|
| committer | Taylan Kammer <taylan.kammer@gmail.com> | 2026-07-27 07:11:46 +0200 |
| commit | c83bdec108bc00f6a266eba31eccb894fae76e97 (patch) | |
| tree | 669aebf063283e9c20f05951223be3e7e1733beb /src/zisp/value.zig | |
| parent | a8d40828eb6c7ace41e7102ac18dc7b406b094eb (diff) | |
Cleanup, fixes, NaN-packing improvement.
Diffstat (limited to 'src/zisp/value.zig')
| -rw-r--r-- | src/zisp/value.zig | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/zisp/value.zig b/src/zisp/value.zig index 1a63349..f075b35 100644 --- a/src/zisp/value.zig +++ b/src/zisp/value.zig @@ -73,12 +73,13 @@ pub const none = Value{ .misc = .{ .value = .none } }; // zig fmt: on /// A plain (unpacked, untagged, uncompressed) pointer into the main heap. -pub const HeapPtr = *align(8) anyopaque; +pub const HeapPtr = *align(16) anyopaque; /// Values for the 8 type bits on main heap pointers. pub const HeapType = enum(u8) { /// Pair (car, cdr) pair, + /// Array of various types: see `ArrayPtr`. array, @@ -115,13 +116,11 @@ pub const hi16_list = hi16(0b0000); pub const hi16_hptr = hi16(0b0001); pub const hi16_istr = hi16(0b0010); pub const hi16_sstr = hi16(0b0011); -pub const hi16_rpos = hi16(0b0100); -pub const hi16_rneg = hi16(0b0101); -pub const hi16_ndef = hi16(0b0110); +pub const hi16_srat = hi16(0b0100); +pub const hi16_ndf1 = hi16(0b0101); +pub const hi16_ndf2 = hi16(0b0110); pub const hi16_rune = hi16(0b0111); -pub const hi15_srat: u15 = @intCast(hi16(0b0100) >> 1); - pub const hi16_const_list = hi16(0b1000); pub const hi16_const_hptr = hi16(0b1001); pub const hi16_const_istr = hi16(0b1010); @@ -195,15 +194,21 @@ pub const Value = packed union { /// Small rat (rational number) srat: packed struct { - q: u24, - p: i25, - _hi: u15 = hi15_srat, + p: i32, + q: u16, + _hi: u16 = hi16_srat, + }, + + /// Undefined 1 + ndf1: packed struct { + _: u48, + _hi: u16 = hi16_ndf1, }, - /// Undefined, for now - ndef: packed struct { + /// Undefined 2 + ndf2: packed struct { _: u48, - _hi: u16 = hi16_ndef, + _hi: u16 = hi16_ndf2, }, /// Rune (6-byte ASCII string) |
