mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:24:33 +01:00
InternPool: we have pointer subtraction now!
This commit is contained in:
parent
74ba5762ec
commit
1983adb8ae
1 changed files with 2 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue