aboutsummaryrefslogtreecommitdiff
path: root/src/InternPool.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-12-16 02:15:36 -0500
committerJacob Young <jacobly0@users.noreply.github.com>2024-12-16 15:11:23 -0500
commit1983adb8ae710a374b4cb1bb4cb5514abac7ddd0 (patch)
treeb040616874843828b46e3437e52ac8892b275b12 /src/InternPool.zig
parent74ba5762ece3029bcac4934b430dd5180f54fe1c (diff)
downloadzig-1983adb8ae710a374b4cb1bb4cb5514abac7ddd0.tar.gz
zig-1983adb8ae710a374b4cb1bb4cb5514abac7ddd0.zip
InternPool: we have pointer subtraction now!
Diffstat (limited to 'src/InternPool.zig')
-rw-r--r--src/InternPool.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig
index 749be6348a..1dbfbb24e1 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -1163,7 +1163,7 @@ const Local = struct {
capacity: u32,
};
fn header(list: ListSelf) *Header {
- return @ptrFromInt(@intFromPtr(list.bytes) - bytes_offset);
+ return @alignCast(@ptrCast(list.bytes - bytes_offset));
}
pub fn view(list: ListSelf) View {
const capacity = list.header().capacity;
@@ -1372,7 +1372,7 @@ const Shard = struct {
}
};
fn header(map: @This()) *Header {
- return @ptrFromInt(@intFromPtr(map.entries) - entries_offset);
+ return @alignCast(@ptrCast(@as([*]u8, @ptrCast(map.entries)) - entries_offset));
}
const Entry = extern struct {