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

Function mi_page_decode_padding

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

Source from the content-addressed store, hash-verified

227
228#if (MI_PADDING>0) && defined(MI_ENCODE_FREELIST) && !MI_TRACK_ENABLED
229static bool mi_page_decode_padding(const mi_page_t* page, const mi_block_t* block, size_t* delta, size_t* bsize) {
230 *bsize = mi_page_usable_block_size(page);
231 const mi_padding_t* const padding = (mi_padding_t*)((uint8_t*)block + *bsize);
232 mi_track_mem_defined(padding,sizeof(mi_padding_t));
233 *delta = padding->delta;
234 uint32_t canary = padding->canary;
235 uintptr_t keys[2];
236 keys[0] = page->keys[0];
237 keys[1] = page->keys[1];
238 bool ok = ((uint32_t)mi_ptr_encode(page,block,keys) == canary && *delta <= *bsize);
239 mi_track_mem_noaccess(padding,sizeof(mi_padding_t));
240 return ok;
241}
242
243// Return the exact usable size of a block.
244static size_t mi_page_usable_size_of(const mi_page_t* page, const mi_block_t* block) {

Callers 3

mi_page_usable_size_ofFunction · 0.85
mi_verify_paddingFunction · 0.85
mi_padding_shrinkFunction · 0.85

Calls 2

mi_ptr_encodeFunction · 0.85

Tested by

no test coverage detected