MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / _mi_bitmap_try_find_from_claim

Function _mi_bitmap_try_find_from_claim

3rd/mimalloc-2.0.9/src/bitmap.c:100–109  ·  view source on GitHub ↗

Find `count` bits of 0 and set them to 1 atomically; returns `true` on success. Starts at idx, and wraps around to search in all `bitmap_fields` fields. `count` can be at most MI_BITMAP_FIELD_BITS and will never cross fields.

Source from the content-addressed store, hash-verified

98// Starts at idx, and wraps around to search in all `bitmap_fields` fields.
99// `count` can be at most MI_BITMAP_FIELD_BITS and will never cross fields.
100bool _mi_bitmap_try_find_from_claim(mi_bitmap_t bitmap, const size_t bitmap_fields, const size_t start_field_idx, const size_t count, mi_bitmap_index_t* bitmap_idx) {
101 size_t idx = start_field_idx;
102 for (size_t visited = 0; visited < bitmap_fields; visited++, idx++) {
103 if (idx >= bitmap_fields) idx = 0; // wrap
104 if (_mi_bitmap_try_find_claim_field(bitmap, idx, count, bitmap_idx)) {
105 return true;
106 }
107 }
108 return false;
109}
110
111// Like _mi_bitmap_try_find_from_claim but with an extra predicate that must be fullfilled
112bool _mi_bitmap_try_find_from_claim_pred(mi_bitmap_t bitmap, const size_t bitmap_fields,

Callers 2

_mi_segment_cache_pushFunction · 0.85

Calls 1

Tested by

no test coverage detected