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

Method compressAlt

cachelib/allocator/memory/SlabAllocator.cpp:584–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582// for benchmarking purposes.
583const unsigned int kMarkerBits = 6;
584CompressedPtr4B SlabAllocator::compressAlt(const void* ptr) const {
585 if (ptr == nullptr) {
586 return CompressedPtr4B{};
587 }
588
589 ptrdiff_t delta = reinterpret_cast<const uint8_t*>(ptr) -
590 reinterpret_cast<const uint8_t*>(slabMemoryStart_);
591 return CompressedPtr4B{
592 static_cast<CompressedPtr4B::PtrType>(delta >> kMarkerBits)};
593}
594
595void* SlabAllocator::unCompressAlt(const CompressedPtr4B cPtr) const {
596 if (cPtr.isNull()) {

Callers 2

buildAllocsFunction · 0.45
BENCHMARKFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected