index: add method for checking range on DenseBitSet

This commit is contained in:
Nia Espera 2025-05-31 10:13:09 +02:00
parent a88fc0eaae
commit a0c19ee577
No known key found for this signature in database
GPG key ID: E7A3AAA3B692EAD7
3 changed files with 46 additions and 4 deletions

View file

@ -145,10 +145,7 @@ impl IsolatedAlloc {
if pinfo.domain_size() < offset_pinfo + size_pinfo {
break;
}
// FIXME: is there a more efficient way to check whether the entire range is unset
// in the bitset?
let range_avail = !(offset_pinfo..offset_pinfo + size_pinfo).any(|i| pinfo.contains(i));
if range_avail {
if !pinfo.contains_any(offset_pinfo..offset_pinfo + size_pinfo) {
pinfo.insert_range(offset_pinfo..offset_pinfo + size_pinfo);
// SAFETY: We checked the available bytes after `idx` in the call
// to `domain_size` above and asserted there are at least `idx +