From ecf75c146aaaeef52d483476c97335cda048e841 Mon Sep 17 00:00:00 2001 From: LN Liberda Date: Mon, 10 Mar 2025 01:52:27 +0100 Subject: [PATCH] Zig 0.14: Page sizes are not compile-time --- src/terminal/PageList.zig | 2 +- src/terminal/page.zig | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/terminal/PageList.zig b/src/terminal/PageList.zig index b838332b0..12e709c6e 100644 --- a/src/terminal/PageList.zig +++ b/src/terminal/PageList.zig @@ -56,7 +56,7 @@ const std_size = Page.layout(std_capacity).total_size; /// allocator because we need memory that is zero-initialized and page-aligned. const PagePool = std.heap.MemoryPoolAligned( [std_size]u8, - std.mem.page_size, + std.heap.page_size_min, ); /// List of pins, known as "tracked" pins. These are pins that are kept diff --git a/src/terminal/page.zig b/src/terminal/page.zig index 0931ac311..53a5e926c 100644 --- a/src/terminal/page.zig +++ b/src/terminal/page.zig @@ -83,7 +83,7 @@ pub const Page = struct { comptime { // The alignment of our members. We want to ensure that the page // alignment is always divisible by this. - assert(std.mem.page_size % @max( + assert(std.heap.page_size_min % @max( @alignOf(Row), @alignOf(Cell), style.Set.base_align, @@ -93,7 +93,7 @@ pub const Page = struct { /// The backing memory for the page. A page is always made up of a /// a single contiguous block of memory that is aligned on a page /// boundary and is a multiple of the system page size. - memory: []align(std.mem.page_size) u8, + memory: []align(std.heap.page_size_min) u8, /// The array of rows in the page. The rows are always in row order /// (i.e. index 0 is the top row, index 1 is the row below that, etc.) @@ -1755,7 +1755,7 @@ pub const Page = struct { const hyperlink_map_start = alignForward(usize, hyperlink_set_end, hyperlink.Map.base_align); const hyperlink_map_end = hyperlink_map_start + hyperlink_map_layout.total_size; - const total_size = alignForward(usize, hyperlink_map_end, std.mem.page_size); + const total_size = alignForward(usize, hyperlink_map_end, std.heap.page_size_min); return .{ .total_size = total_size,