Use 'Square::index' in 'Square::{file,rank}_index'
This commit is contained in:
parent
17b8ee5eb3
commit
e8b5c9f73c
|
@ -69,13 +69,13 @@ impl Square {
|
||||||
/// Return the index of the rank of this square (0 -> rank 1, ..., 7 -> rank 8).
|
/// Return the index of the rank of this square (0 -> rank 1, ..., 7 -> rank 8).
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn rank_index(self) -> usize {
|
pub fn rank_index(self) -> usize {
|
||||||
(self as usize) % 8
|
self.index() % 8
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the index of the rank of this square (0 -> file A, ..., 7 -> file H).
|
/// Return the index of the rank of this square (0 -> file A, ..., 7 -> file H).
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn file_index(self) -> usize {
|
pub fn file_index(self) -> usize {
|
||||||
(self as usize) / 8
|
self.index() / 8
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a [Rank] representing the rank of this square.
|
/// Return a [Rank] representing the rank of this square.
|
||||||
|
|
Loading…
Reference in a new issue