[bitboard] Export the bit_scanner module
Clients can access TrailingBitScanner and LeadingBitScanner directly now.
This commit is contained in:
parent
994f17091b
commit
c02f0170b9
2 changed files with 5 additions and 4 deletions
|
@ -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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue