Try to clear `n` bits at `idx` where `n <= MI_BCHUNK_BITS`.
| 1700 | |
| 1701 | // Try to clear `n` bits at `idx` where `n <= MI_BCHUNK_BITS`. |
| 1702 | bool mi_bbitmap_try_clearNC(mi_bbitmap_t* bbitmap, size_t idx, size_t n) { |
| 1703 | mi_assert_internal(n>0); |
| 1704 | mi_assert_internal(n<=MI_BCHUNK_BITS); |
| 1705 | mi_assert_internal(idx + n <= mi_bbitmap_max_bits(bbitmap)); |
| 1706 | |
| 1707 | const size_t chunk_idx = idx / MI_BCHUNK_BITS; |
| 1708 | const size_t cidx = idx % MI_BCHUNK_BITS; |
| 1709 | mi_assert_internal(cidx + n <= MI_BCHUNK_BITS); // don't cross chunks (for now) |
| 1710 | mi_assert_internal(chunk_idx < mi_bbitmap_chunk_count(bbitmap)); |
| 1711 | if (cidx + n > MI_BCHUNK_BITS) return false; |
| 1712 | bool maybe_all_clear = false; |
| 1713 | const bool cleared = mi_bchunk_try_clearN(&bbitmap->chunks[chunk_idx], cidx, n, &maybe_all_clear); |
| 1714 | if (cleared && maybe_all_clear) { mi_bbitmap_chunkmap_try_clear(bbitmap, chunk_idx); } |
| 1715 | // note: we don't set the size class for an explicit try_clearN (only used by purging) |
| 1716 | return cleared; |
| 1717 | } |
| 1718 | |
| 1719 | |
| 1720 |
no test coverage detected