Use unchecked conversion in 'BitboardIterator

This commit is contained in:
Bruno BELANYI 2022-07-29 19:26:05 +02:00
parent eefa707c07
commit 024a41fa18

View file

@ -11,7 +11,8 @@ impl Iterator for BitboardIterator {
} else {
let lsb = self.0.trailing_zeros() as usize;
self.0 ^= 1 << lsb;
Some(crate::board::Square::from_index(lsb))
// SAFETY: we know the value is in-bounds
Some(unsafe { crate::board::Square::from_index_unchecked(lsb) })
}
}