From e26e81aa33dc1ecc2f26de26b1d420d288a28493 Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Sun, 16 Aug 2026 10:01:12 +0200 Subject: Implemented meta allocator. --- src/zisp/value/ptr.zig | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/zisp/value/ptr.zig (limited to 'src/zisp/value/ptr.zig') diff --git a/src/zisp/value/ptr.zig b/src/zisp/value/ptr.zig deleted file mode 100644 index 8a3ca18..0000000 --- a/src/zisp/value/ptr.zig +++ /dev/null @@ -1,33 +0,0 @@ -const std = @import("std"); - -const gc = @import("../gc.zig"); -const value = @import("../value.zig"); - -const HeapType = value.HeapType; -const Value = value.Value; -const Zptr = value.Zptr; - -const max = std.math.maxInt; - -// Zig API - -pub fn check(v: Value) bool { - return v.isPtrAny(); -} - -pub fn assert(v: Value) void { - if (!check(v)) { - v.dump(); - @panic("not pointer"); - } -} - -pub fn pack(comptime ht: HeapType, ptr: ht.PtrType()) Value { - const index: u44 = @intCast(@intFromPtr(ptr) >> 4); - return .{ .ptr = .{ .index = index, .htype = ht } }; -} - -pub fn unpack(v: Value) struct { HeapType, ?Zptr } { - assert(v); - return v.getPtrAny() orelse unreachable; -} -- cgit v1.2.3