mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-10 18:09:32 +00:00
fixed default page size on posix
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user