aboutsummaryrefslogtreecommitdiff
path: root/src/bitboard.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2024-01-25 11:24:36 +0100
committereug-vs <eugene@eug-vs.xyz>2024-01-25 11:24:36 +0100
commit746e3bf17463a377b6c54b291ebef9a736d6ceb7 (patch)
treea4e965669871084b98d3ce89ac95fa9d50131699 /src/bitboard.rs
parent299c6d6dee96a50f9366955192f922d449d11f20 (diff)
downloadchessnost-746e3bf17463a377b6c54b291ebef9a736d6ceb7.tar.gz
chore: autoformat codecanary
Use #[rustfmt:skip] to preserve aligned blocks
Diffstat (limited to 'src/bitboard.rs')
-rw-r--r--src/bitboard.rs18
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;