Get the page size on Windows
This commit is contained in:
parent
677c4fd6e1
commit
671ba8312a
@ -17,14 +17,20 @@ static std::string Executable_Path;
|
||||
|
||||
bool System::init(char * argv[])
|
||||
{
|
||||
long sc_page_size = sysconf(_SC_PAGESIZE);
|
||||
if (sc_page_size < 0)
|
||||
#if defined(PLATFORM_LINUX)
|
||||
long system_page_size = sysconf(_SC_PAGESIZE);
|
||||
if (system_page_size < 0)
|
||||
{
|
||||
fprintf(stderr, "Unable to determine operating system page size.\n");
|
||||
return false;
|
||||
}
|
||||
#elif defined(PLATFORM_WINDOWS)
|
||||
SYSTEM_INFO system_info = {0};
|
||||
GetSystemInfo(&system_info);
|
||||
unsigned long system_page_size = system_info.dwPageSize;
|
||||
#endif
|
||||
|
||||
System::page_size = (unsigned long)sc_page_size;
|
||||
System::page_size = (unsigned long)system_page_size;
|
||||
System::page_size_log = 0u;
|
||||
System::page_offset_mask = System::page_size - 1u;
|
||||
System::page_base_mask = ~System::page_offset_mask;
|
||||
|
Loading…
x
Reference in New Issue
Block a user