mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-09-17 19:54:47 +03:00
restructure the page flags to use explicit masks
This commit is contained in:
parent
c0258b2d29
commit
ed785253bf
6 changed files with 53 additions and 45 deletions
|
@ -43,7 +43,7 @@ static void* mi_heap_malloc_zero_aligned_at(mi_heap_t* heap, size_t size, size_t
|
|||
if (p == NULL) return NULL;
|
||||
|
||||
// .. and align within the allocation
|
||||
_mi_ptr_page(p)->flags.has_aligned = true;
|
||||
mi_page_set_has_aligned( _mi_ptr_page(p), true );
|
||||
uintptr_t adjust = alignment - (((uintptr_t)p + offset) % alignment);
|
||||
mi_assert_internal(adjust % sizeof(uintptr_t) == 0);
|
||||
void* aligned_p = (adjust == alignment ? p : (void*)((uintptr_t)p + adjust));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue