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.
| 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. |
| 100 | bool _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 |
| 112 | bool _mi_bitmap_try_find_from_claim_pred(mi_bitmap_t bitmap, const size_t bitmap_fields, |
no test coverage detected