From df7af333d4276b0c18a68bb936e8ad95c4a38079 Mon Sep 17 00:00:00 2001 From: Carlyle Date: Tue, 24 Mar 2026 22:28:32 -0700 Subject: [PATCH] fixed default page size on posix --- core/mem/mem_posix.odin | 2 +- core/mem/mem_windows.odin | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/mem/mem_posix.odin b/core/mem/mem_posix.odin index c4af5c48a..f652e6a25 100644 --- a/core/mem/mem_posix.odin +++ b/core/mem/mem_posix.odin @@ -6,7 +6,7 @@ import "core:sys/posix" @(init, private, no_sanitize_address) query_page_size_init :: proc "contextless" () { size := posix.sysconf(._PAGESIZE) - PAGE_SIZE = int(max(size, 4096)) + PAGE_SIZE = max(PAGE_SIZE, int(size)) // is power of two assert_contextless(PAGE_SIZE != 0 && (PAGE_SIZE & (PAGE_SIZE-1)) == 0) diff --git a/core/mem/mem_windows.odin b/core/mem/mem_windows.odin index d7e55eb09..09f14d5d0 100644 --- a/core/mem/mem_windows.odin +++ b/core/mem/mem_windows.odin @@ -5,10 +5,12 @@ import "core:sys/windows" @(init, private, no_sanitize_address) query_page_size_init :: proc "contextless" () { - sys_info: windows.SYSTEM_INFO - windows.GetSystemInfo(&sys_info) - PAGE_SIZE = max(PAGE_SIZE, int(sys_info.dwPageSize)) - + info: windows.SYSTEM_INFO + windows.GetSystemInfo(&info) + + size := info.dwPageSize + PAGE_SIZE = max(PAGE_SIZE, int(size)) + // is power of two assert_contextless(PAGE_SIZE != 0 && (PAGE_SIZE & (PAGE_SIZE-1)) == 0) } \ No newline at end of file