aboutsummaryrefslogtreecommitdiff
path: root/src/bitboard.rs
diff options
context:
space:
mode:
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)
}