[bitboard] Export the bit_scanner module

Clients can access TrailingBitScanner and LeadingBitScanner directly now.
This commit is contained in:
Eryn Wells 2025-05-23 18:38:15 -07:00
parent 994f17091b
commit c02f0170b9
2 changed files with 5 additions and 4 deletions

View file

@ -20,7 +20,7 @@ macro_rules! bit_scanner {
bit_scanner!(LeadingBitScanner); bit_scanner!(LeadingBitScanner);
bit_scanner!(TrailingBitScanner); bit_scanner!(TrailingBitScanner);
fn _index_to_square(index: usize) -> Square { fn index_to_square(index: usize) -> Square {
unsafe { unsafe {
#[allow(clippy::cast_possible_truncation)] #[allow(clippy::cast_possible_truncation)]
Square::from_index_unchecked(index as u8) Square::from_index_unchecked(index as u8)
@ -49,7 +49,7 @@ impl Iterator for LeadingBitScanner {
// Shift 1 additional place to account for the 1 that `leading_zeros` found. // Shift 1 additional place to account for the 1 that `leading_zeros` found.
self.shift += leading_zeros + 1; self.shift += leading_zeros + 1;
Some(_index_to_square(position)) Some(index_to_square(position))
} }
} }
@ -75,7 +75,7 @@ impl Iterator for TrailingBitScanner {
// Shift 1 additional place to account for the 1 that `leading_zeros` found. // Shift 1 additional place to account for the 1 that `leading_zeros` found.
self.shift += trailing_zeros + 1; self.shift += trailing_zeros + 1;
Some(_index_to_square(position)) Some(index_to_square(position))
} }
} }

View file

@ -1,6 +1,7 @@
// Eryn Wells <eryn@erynwells.me> // Eryn Wells <eryn@erynwells.me>
mod bit_scanner; pub mod bit_scanner;
mod bitboard; mod bitboard;
mod direction; mod direction;
mod library; mod library;