mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 15:09:31 +03:00
Merge branch 'dev' of https://github.com/microsoft/mimalloc into dev
This commit is contained in:
commit
2d79ae7ecf
1 changed files with 4 additions and 3 deletions
|
@ -56,9 +56,10 @@ static mi_decl_noinline void* mi_heap_malloc_zero_aligned_at_fallback(mi_heap_t*
|
||||||
}
|
}
|
||||||
|
|
||||||
// .. and align within the allocation
|
// .. and align within the allocation
|
||||||
uintptr_t adjust = alignment - (((uintptr_t)p + offset) & align_mask);
|
const uintptr_t poffset = ((uintptr_t)p + offset) & align_mask;
|
||||||
mi_assert_internal(adjust <= alignment);
|
const uintptr_t adjust = (poffset == 0 ? 0 : alignment - poffset);
|
||||||
void* aligned_p = (adjust == alignment ? p : (void*)((uintptr_t)p + adjust));
|
mi_assert_internal(adjust < alignment);
|
||||||
|
void* aligned_p = (void*)((uintptr_t)p + adjust);
|
||||||
if (aligned_p != p) {
|
if (aligned_p != p) {
|
||||||
mi_page_set_has_aligned(_mi_ptr_page(p), true);
|
mi_page_set_has_aligned(_mi_ptr_page(p), true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue