X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;h=7ae1effd9487f036407f3429c8a5047ec6f52023;hp=a813ea12b3cc73a0fd5d2b8df2650e15959f8289;hb=2af2c67650c4ac2531e6ab2753830f91c0999876;hpb=a03e98dcd33c91c47e4a06282bfb582e582671b7 diff --git a/src/bitboard.h b/src/bitboard.h index a813ea12..7ae1effd 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -107,22 +107,27 @@ extern Magic BishopMagics[SQUARE_NB]; /// whether a given bit is set in a bitboard, and for setting and clearing bits. 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]; } inline Bitboard& operator^=(Bitboard& b, Square s) { + assert(s >= SQ_A1 && s <= SQ_H8); return b ^= SquareBB[s]; }