This commit is contained in:
2022-12-23 23:57:29 +01:00
parent 87adca7e66
commit cb0fcc4702
14 changed files with 208 additions and 52 deletions

View File

@@ -39,6 +39,9 @@ public:
explicit constexpr operator bool() const {
return mBoard != 0;
}
explicit constexpr operator unsigned int() const {
return mBoard;
}
explicit constexpr operator unsigned long() const {
return mBoard;
}
@@ -125,6 +128,7 @@ public:
// WARN: Check for 0!
unsigned lsb() const;
unsigned pop();
constexpr int count() const;
private:
U64 mBoard = 0;
@@ -282,4 +286,9 @@ inline unsigned BitBoard::pop() {
return i;
}
constexpr int BitBoard::count() const {
return __builtin_popcountll(mBoard);
}
#endif //CHESS_ENGINE_BITBOARD_HPP