From 74973416aa6a7b0fae9ed2b9911fa18fe87c4e1c Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 21 Jan 2023 18:24:52 +0300 Subject: feat: precompute first rank attacks --- src/bitboard.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/bitboard.rs') 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) } -- cgit v1.2.3