MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / slab_map_indices

Function slab_map_indices

src/foundation/slab_alloc.c:136–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136static bool slab_map_indices(uintptr_t base, size_t *i1, size_t *i2, size_t *i3) {
137 uintptr_t pnum = base >> SLAB_PAGE_SHIFT;
138 if ((pnum >> SLAB_MAP_TOTAL_BITS) != 0) {
139 return false; /* address beyond coverage — never produced by malloc here */
140 }
141 *i1 = (size_t)((pnum >> (SLAB_MAP_L2_BITS + SLAB_MAP_L3_BITS)) & (SLAB_MAP_L1_SIZE - 1));
142 *i2 = (size_t)((pnum >> SLAB_MAP_L3_BITS) & (SLAB_MAP_L2_SIZE - 1));
143 *i3 = (size_t)(pnum & (SLAB_MAP_L3_SIZE - 1));
144 return true;
145}
146
147/* Lock-free. Returns the slab page whose base == (ptr & mask), or NULL if the
148 * masked base is not a registered slab page (i.e. ptr is a plain heap block). */

Callers 2

slab_map_lookupFunction · 0.85
slab_map_setFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected