From 057b383f8c1d44dc4ecbc19f3f6625af3eb97c42 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 18 Jul 2022 00:31:33 +0200 Subject: [PATCH] Add 'Bitboard::is_empty' --- src/board/bitboard/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/board/bitboard/mod.rs b/src/board/bitboard/mod.rs index d2f3723..04b205a 100644 --- a/src/board/bitboard/mod.rs +++ b/src/board/bitboard/mod.rs @@ -49,6 +49,12 @@ impl Bitboard { pub fn count(self) -> u32 { self.0.count_ones() } + + /// Return true if there are no pieces in the [Bitboard], otherwise false. + #[inline(always)] + pub fn is_empty(self) -> bool { + self == Self::EMPTY + } } impl Default for Bitboard {