diff options
Diffstat (limited to 'src/bitboard.rs')
-rw-r--r-- | src/bitboard.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/bitboard.rs b/src/bitboard.rs index 48a60d8..ab029bc 100644 --- a/src/bitboard.rs +++ b/src/bitboard.rs @@ -43,18 +43,12 @@ pub trait BitboardFns { fn nort_fill(self) -> Self; /// Return bitboard with a sout fill fn sout_fill(self) -> Self; - } const DE_BRUJIN_SEQUENCE: [u8; 64] = [ - 0, 1, 48, 2, 57, 49, 28, 3, - 61, 58, 50, 42, 38, 29, 17, 4, - 62, 55, 59, 36, 53, 51, 43, 22, - 45, 39, 33, 30, 24, 18, 12, 5, - 63, 47, 56, 27, 60, 41, 37, 16, - 54, 35, 52, 21, 44, 32, 23, 11, - 46, 26, 40, 15, 34, 20, 31, 10, - 25, 14, 19, 9, 13, 8, 7, 6 + 0, 1, 48, 2, 57, 49, 28, 3, 61, 58, 50, 42, 38, 29, 17, 4, 62, 55, 59, 36, 53, 51, 43, 22, 45, + 39, 33, 30, 24, 18, 12, 5, 63, 47, 56, 27, 60, 41, 37, 16, 54, 35, 52, 21, 44, 32, 23, 11, 46, + 26, 40, 15, 34, 20, 31, 10, 25, 14, 19, 9, 13, 8, 7, 6, ]; static NOT_A_FILE: Bitboard = 0xFEFEFEFEFEFEFEFE; @@ -85,15 +79,13 @@ impl BitboardFns for Bitboard { count } - fn ls1b(self) -> Self { if self == 0 { - return 0 + return 0; } self & !(self - 1) } - fn bitscan(self) -> Square { // TODO: generate private De Brujin routine debug_assert!(self != 0, "Can not bitscan empty bitboard"); @@ -146,7 +138,7 @@ impl BitboardFns for Bitboard { } } -pub struct SquareIterator (Bitboard); +pub struct SquareIterator(Bitboard); impl Iterator for SquareIterator { type Item = Square; |