MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / IdxAllocObject

Function IdxAllocObject

src/storage.cpp:61–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 ppool->pobjpageHead = pool_allocate_page(cbObject);
60}
61static int IdxAllocObject(struct object_page *page)
62{
63 for (size_t iword = 0; iword < OBJ_PAGE_BITS_PER_WORD; ++iword)
64 {
65 if ((page->allocmap[iword] + 1) != 0)
66 {
67 int ibit = 0;
68 uint64_t bitword = page->allocmap[iword];
69 while (bitword & 1)
70 {
71 bitword >>= 1;
72 ++ibit;
73 }
74 page->allocmap[iword] |= 1ULL << ibit;
75 return (iword * OBJ_PAGE_BITS_PER_WORD) + ibit;
76 }
77 }
78 return -1;
79}
80void *pool_alloc(struct alloc_pool *ppool)
81{
82 struct object_page *cur = ppool->pobjpageHead;

Callers 1

pool_allocFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected