feat(bitmap): Add bit and for AllocBitMap (#793)

This commit is contained in:
LoGin
2024-04-30 18:45:01 +08:00
committed by GitHub
parent 7401bec5e3
commit 7db6e06354
3 changed files with 45 additions and 0 deletions

View File

@ -1,3 +1,5 @@
use core::ops::BitAnd;
use bitmap::{traits::BitMapOps, AllocBitmap};
use crate::{mm::percpu::PerCpu, smp::cpu::ProcessorId};
@ -86,6 +88,15 @@ impl CpuMask {
}
}
impl BitAnd for CpuMask {
type Output = Self;
fn bitand(self, rhs: Self) -> Self::Output {
let bmp = self.bmp & rhs.bmp;
Self { bmp }
}
}
pub struct CpuMaskIter<'a> {
mask: &'a CpuMask,
index: Option<ProcessorId>,