diff options
| author | Taylan Kammer <taylan.kammer@gmail.com> | 2026-06-22 19:05:48 +0200 |
|---|---|---|
| committer | Taylan Kammer <taylan.kammer@gmail.com> | 2026-06-22 19:05:48 +0200 |
| commit | 8308e303a88779be0d0a6249d2d79ca56eb05ed0 (patch) | |
| tree | 524e5fb474ce890fbf1e9b5311a7e7cdba33b0de /src/zisp | |
| parent | 476632d9559b1e3bacbd226df336116cac8544ea (diff) | |
Fix tests etc.
Diffstat (limited to 'src/zisp')
| -rw-r--r-- | src/zisp/value.zig | 6 | ||||
| -rw-r--r-- | src/zisp/value/ptr.zig | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/zisp/value.zig b/src/zisp/value.zig index 2ae0524..fc815bd 100644 --- a/src/zisp/value.zig +++ b/src/zisp/value.zig @@ -272,13 +272,13 @@ pub const Value = packed union { /// if this isn't a pointer at all. Could be useful for a dispatch table. /// Note that unlike getPtr(), this can actually return a null pointer as /// such, not conflating it with the "not a heap pointer" case. - pub fn getPtrAny(v: Value) ?struct { ?Zptr, HeapType } { + pub fn getPtrAny(v: Value) ?struct { HeapType, ?Zptr } { const hi16_bits: u16 = @intCast(v.bits >> 48); if (hi16_bits != hi16_tag_ptr) return null; - const ht: u4 = @truncate(hi16_bits); + const ht: u4 = @intCast(v.bits << 16 >> 60); const pval: u48 = @intCast(v.bits << 20 >> 16); - return .{ @ptrFromInt(pval), @enumFromInt(ht) }; + return .{ @enumFromInt(ht), @ptrFromInt(pval) }; } /// Checks if the value is a list pointer. diff --git a/src/zisp/value/ptr.zig b/src/zisp/value/ptr.zig index 3a6995b..8a3ca18 100644 --- a/src/zisp/value/ptr.zig +++ b/src/zisp/value/ptr.zig @@ -27,7 +27,7 @@ pub fn pack(comptime ht: HeapType, ptr: ht.PtrType()) Value { return .{ .ptr = .{ .index = index, .htype = ht } }; } -pub fn unpack(v: Value) struct { Zptr, HeapType } { +pub fn unpack(v: Value) struct { HeapType, ?Zptr } { assert(v); return v.getPtrAny() orelse unreachable; } |
