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

Function bitmap_unset

deps/jemalloc/include/jemalloc/internal/bitmap.h:330–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330static inline void
331bitmap_unset(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit) {
332 size_t goff;
333 bitmap_t *gp;
334 bitmap_t g;
335 UNUSED bool propagate;
336
337 assert(bit < binfo->nbits);
338 assert(bitmap_get(bitmap, binfo, bit));
339 goff = bit >> LG_BITMAP_GROUP_NBITS;
340 gp = &bitmap[goff];
341 g = *gp;
342 propagate = (g == 0);
343 assert((g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK))) == 0);
344 g ^= ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK);
345 *gp = g;
346 assert(!bitmap_get(bitmap, binfo, bit));
347#ifdef BITMAP_USE_TREE
348 /* Propagate group state transitions up the tree. */
349 if (propagate) {
350 unsigned i;
351 for (i = 1; i < binfo->nlevels; i++) {
352 bit = goff;
353 goff = bit >> LG_BITMAP_GROUP_NBITS;
354 gp = &bitmap[binfo->levels[i].group_offset + goff];
355 g = *gp;
356 propagate = (g == 0);
357 assert((g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK)))
358 == 0);
359 g ^= ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK);
360 *gp = g;
361 if (!propagate) {
362 break;
363 }
364 }
365 }
366#endif /* BITMAP_USE_TREE */
367}
368
369#endif /* JEMALLOC_INTERNAL_BITMAP_H */

Callers 4

test_bitmap_unset_bodyFunction · 0.50
test_bitmap_xfu_bodyFunction · 0.50
extents_insert_lockedFunction · 0.50
arena_slab_reg_dallocFunction · 0.50

Calls 1

bitmap_getFunction · 0.70

Tested by 2

test_bitmap_unset_bodyFunction · 0.40
test_bitmap_xfu_bodyFunction · 0.40