MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / _mi_page_ptr_unalign

Function _mi_page_ptr_unalign

3rd/mimalloc-2.0.9/src/alloc.c:474–479  ·  view source on GitHub ↗

Adjust a block that was allocated aligned, to the actual start of the block in the page.

Source from the content-addressed store, hash-verified

472
473// Adjust a block that was allocated aligned, to the actual start of the block in the page.
474mi_block_t* _mi_page_ptr_unalign(const mi_segment_t* segment, const mi_page_t* page, const void* p) {
475 mi_assert_internal(page!=NULL && p!=NULL);
476 const size_t diff = (uint8_t*)p - _mi_page_start(segment, page, NULL);
477 const size_t adjust = (diff % mi_page_block_size(page));
478 return (mi_block_t*)((uintptr_t)p - adjust);
479}
480
481
482void mi_decl_noinline _mi_free_generic(const mi_segment_t* segment, mi_page_t* page, bool is_local, void* p) mi_attr_noexcept {

Callers 3

_mi_free_genericFunction · 0.85
alloc-aligned.cFile · 0.85

Calls 2

_mi_page_startFunction · 0.85
mi_page_block_sizeFunction · 0.85

Tested by

no test coverage detected