From 8308e303a88779be0d0a6249d2d79ca56eb05ed0 Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Mon, 22 Jun 2026 19:05:48 +0200 Subject: Fix tests etc. --- src/zisp/value.zig | 6 +++--- src/zisp/value/ptr.zig | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/zisp') 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; } -- cgit v1.2.3