Add page allocation utility functions
This commit is contained in:
@@ -51,6 +51,25 @@ void UnixPlatform::Free(void* ptr)
|
||||
}
|
||||
}
|
||||
|
||||
uint64 Win32Platform::GetDefaultPageSize()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
void* Win32Platform::AllocatePages(uint64 numPages, uint64 pageSize)
|
||||
{
|
||||
const uint64 numBytes = numPages * pageSize;
|
||||
|
||||
// Fallback to malloc
|
||||
return malloc(numBytes);
|
||||
}
|
||||
|
||||
void Win32Platform::FreePages(void* ptr)
|
||||
{
|
||||
// Fallback to free
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
uint64 UnixPlatform::GetCurrentProcessId()
|
||||
{
|
||||
return getpid();
|
||||
|
||||
@@ -16,6 +16,9 @@ public:
|
||||
// [PlatformBase]
|
||||
static void* Allocate(uint64 size, uint64 alignment);
|
||||
static void Free(void* ptr);
|
||||
static uint64 GetDefaultPageSize();
|
||||
static void* AllocatePages(uint64 numPages, uint64 pageSize);
|
||||
static void FreePages(void* ptr);
|
||||
static uint64 GetCurrentProcessId();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user