X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;fp=src%2Fbitboard.h;h=6907f184e5429c12866d504e3e69a6ca49979658;hp=af7b592ad564cb5a3af85ca97173d5259e390484;hb=796d0ad70eaadf1a354d6565181331c981432f2d;hpb=7133598a98301cf84857d39194026b876da48b96 diff --git a/src/bitboard.h b/src/bitboard.h index af7b592a..6907f184 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -106,30 +106,16 @@ extern Magic BishopMagics[SQUARE_NB]; /// Overloads of bitwise operators between a Bitboard and a Square for testing /// whether a given bit is set in a bitboard, and for setting and clearing bits. -inline Bitboard operator&(Bitboard b, Square s) { +inline Bitboard square_bb(Square s) { assert(s >= SQ_A1 && s <= SQ_H8); - return b & SquareBB[s]; -} - -inline Bitboard operator|(Bitboard b, Square s) { - assert(s >= SQ_A1 && s <= SQ_H8); - return b | SquareBB[s]; -} - -inline Bitboard operator^(Bitboard b, Square s) { - assert(s >= SQ_A1 && s <= SQ_H8); - return b ^ SquareBB[s]; -} - -inline Bitboard& operator|=(Bitboard& b, Square s) { - assert(s >= SQ_A1 && s <= SQ_H8); - return b |= SquareBB[s]; -} - -inline Bitboard& operator^=(Bitboard& b, Square s) { - assert(s >= SQ_A1 && s <= SQ_H8); - return b ^= SquareBB[s]; -} + return SquareBB[s]; +} + +inline Bitboard operator&( Bitboard b, Square s) { return b & square_bb(s); } +inline Bitboard operator|( Bitboard b, Square s) { return b | square_bb(s); } +inline Bitboard operator^( Bitboard b, Square s) { return b ^ square_bb(s); } +inline Bitboard& operator|=(Bitboard& b, Square s) { return b |= square_bb(s); } +inline Bitboard& operator^=(Bitboard& b, Square s) { return b ^= square_bb(s); } constexpr bool more_than_one(Bitboard b) { return b & (b - 1);