[board, core, bitboard] Clean up casts between Rank, File and BitBoard
Let BitBoard::rank and BitBoard::file take a Rank and File directly, instead of a u8 by reference. And then make the Rank/File::as_index const and return a value rather than a reference. All this allows you to convert between Rank, File, and BitBoard at compile tile (i.e. as a const method) rather than needing to do runtime stuff.
This commit is contained in:
parent
588f049290
commit
3684e9b425
3 changed files with 24 additions and 25 deletions
|
@ -88,8 +88,8 @@ macro_rules! range_bound_struct {
|
|||
}
|
||||
|
||||
#[must_use]
|
||||
$vis fn as_index(&self) -> &$repr {
|
||||
&self.0
|
||||
$vis const fn as_index(&self) -> usize {
|
||||
self.0 as usize
|
||||
}
|
||||
|
||||
$vis fn iter(&self) -> impl Iterator<Item = Self> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue