Set `count` bits at `bitmap_idx` to 0 atomically Returns `true` if all `count` bits were 1 previously.
| 326 | // Set `count` bits at `bitmap_idx` to 0 atomically |
| 327 | // Returns `true` if all `count` bits were 1 previously. |
| 328 | bool _mi_bitmap_unclaim_across(mi_bitmap_t bitmap, size_t bitmap_fields, size_t count, mi_bitmap_index_t bitmap_idx) { |
| 329 | size_t idx = mi_bitmap_index_field(bitmap_idx); |
| 330 | size_t pre_mask; |
| 331 | size_t mid_mask; |
| 332 | size_t post_mask; |
| 333 | size_t mid_count = mi_bitmap_mask_across(bitmap_idx, bitmap_fields, count, &pre_mask, &mid_mask, &post_mask); |
| 334 | bool all_one = true; |
| 335 | mi_bitmap_field_t* field = &bitmap[idx]; |
| 336 | size_t prev = mi_atomic_and_acq_rel(field++, ~pre_mask); |
| 337 | if ((prev & pre_mask) != pre_mask) all_one = false; |
| 338 | while(mid_count-- > 0) { |
| 339 | prev = mi_atomic_and_acq_rel(field++, ~mid_mask); |
| 340 | if ((prev & mid_mask) != mid_mask) all_one = false; |
| 341 | } |
| 342 | if (post_mask!=0) { |
| 343 | prev = mi_atomic_and_acq_rel(field, ~post_mask); |
| 344 | if ((prev & post_mask) != post_mask) all_one = false; |
| 345 | } |
| 346 | return all_one; |
| 347 | } |
| 348 | |
| 349 | // Set `count` bits at `bitmap_idx` to 1 atomically |
| 350 | // Returns `true` if all `count` bits were 0 previously. `any_zero` is `true` if there was at least one zero bit. |
no test coverage detected