MCPcopy Create free account
hub / github.com/facebook/CacheLib / getAllocIdx

Method getAllocIdx

cachelib/allocator/memory/AllocationClass.cpp:371–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371size_t AllocationClass::getAllocIdx(const Slab* slab,
372 void* alloc) const noexcept {
373 const size_t offset = reinterpret_cast<uintptr_t>(alloc) -
374 reinterpret_cast<uintptr_t>(slab->memoryAtOffset(0));
375 XDCHECK_EQ(0u, offset % allocationSize_);
376 XDCHECK_LT(offset, Slab::kSize);
377 return offset / allocationSize_;
378}
379
380void AllocationClass::partitionFreeAllocs(const Slab* slab,
381 FreeList& freeAllocs,

Callers 2

compareCompressedPtrMethod · 0.80

Calls

no outgoing calls

Tested by 1

compareCompressedPtrMethod · 0.64