aboutsummaryrefslogtreecommitdiff
path: root/src/bitboard.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-21 18:24:52 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-21 18:26:07 +0300
commit74973416aa6a7b0fae9ed2b9911fa18fe87c4e1c (patch)
tree0f76f0604177e8412638de88f3c2481bf429cd50 /src/bitboard.rs
parent56f80a81852ef9fa6c1654c8548751fb898f2fb3 (diff)
downloadchessnost-74973416aa6a7b0fae9ed2b9911fa18fe87c4e1c.tar.gz
feat: precompute first rank attacks
Diffstat (limited to 'src/bitboard.rs')
-rw-r--r--src/bitboard.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bitboard.rs b/src/bitboard.rs
index 6481863..646006c 100644
--- a/src/bitboard.rs
+++ b/src/bitboard.rs
@@ -24,6 +24,9 @@ pub fn pop_count(bb: Bitboard) -> u8 {
/// Return Bitboard with only Least Single Bit
pub fn ls1b(bb: Bitboard) -> u64 {
+ if bb == 0 {
+ return 0
+ }
bb & !(bb - 1)
}