Skip to content

Commit 714fd4f

Browse files
heap: add window support for page size
1 parent 4267aec commit 714fd4f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/std/heap.zig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,12 @@ pub fn pageSize() usize {
585585
page_size = switch (builtin.os.tag) {
586586
.linux => if (builtin.link_libc) @intCast(std.c.sysconf(std.os.linux.SC.PAGESIZE)) else std.os.linux.getauxval(std.elf.AT_PAGESZ),
587587
.macos => std.os.darwin.machTaskForSelf().getPageSize() catch mem.page_size,
588-
else => if (builtin.link_libc and @hasDecl(std.c, "getpagesize")) std.c.getpagesize() else mem.page_size,
588+
.windows => blk: {
589+
var info: std.os.windows.SYSTEM_INFO = undefined;
590+
std.os.windows.kernel32.GetSystemInfo(&info);
591+
break :blk info.dwPageSize;
592+
},
593+
else => if (builtin.link_libc and @hasDecl(std.c, "getpagesize")) @intCast(std.c.getpagesize()) else mem.page_size,
589594
};
590595
return page_size.?;
591596
}

src/Builtin.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub fn append(opts: @This(), buffer: *std.ArrayList(u8)) Allocator.Error!void {
152152
),
153153
}
154154
try buffer.writer().print(
155-
\\};
155+
\\}};
156156
\\pub const target: std.Target = .{{
157157
\\ .cpu = cpu,
158158
\\ .os = os,

0 commit comments

Comments
 (0)