mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Align committed to a page size
This commit is contained in:
@@ -69,7 +69,12 @@ align_formula :: #force_inline proc "contextless" (size, align: uint) -> uint {
|
|||||||
memory_block_alloc :: proc(committed, reserved: uint, flags: Memory_Block_Flags) -> (block: ^Memory_Block, err: Allocator_Error) {
|
memory_block_alloc :: proc(committed, reserved: uint, flags: Memory_Block_Flags) -> (block: ^Memory_Block, err: Allocator_Error) {
|
||||||
page_size := DEFAULT_PAGE_SIZE
|
page_size := DEFAULT_PAGE_SIZE
|
||||||
assert(mem.is_power_of_two(uintptr(page_size)))
|
assert(mem.is_power_of_two(uintptr(page_size)))
|
||||||
|
|
||||||
committed := committed
|
committed := committed
|
||||||
|
reserved := reserved
|
||||||
|
|
||||||
|
committed = align_formula(committed, page_size)
|
||||||
|
reserved = align_formula(reserved, page_size)
|
||||||
committed = clamp(committed, 0, reserved)
|
committed = clamp(committed, 0, reserved)
|
||||||
|
|
||||||
total_size := uint(reserved + size_of(Platform_Memory_Block))
|
total_size := uint(reserved + size_of(Platform_Memory_Block))
|
||||||
|
|||||||
Reference in New Issue
Block a user