X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=ce13017dd0e5ab4389f2ba19d7d86c96b0a38871;hp=d94ef185ac9c45a47de27148ce34f8dfe0ff3685;hb=95ba7f78d5e025499ec8124e37e9f3b769660e4a;hpb=e917bd59b1e317c6b48dc676473359fdfb86d9d4 diff --git a/src/position.h b/src/position.h index d94ef185..ce13017d 100644 --- a/src/position.h +++ b/src/position.h @@ -265,7 +265,7 @@ inline bool Position::can_castle(CastlingRight cr) const { } inline int Position::castling_rights(Color c) const { - return st->castlingRights & ((WHITE_OO | WHITE_OOO) << (2 * c)); + return st->castlingRights & (c == WHITE ? WHITE_CASTLING : BLACK_CASTLING); } inline bool Position::castling_impeded(CastlingRight cr) const { @@ -310,7 +310,7 @@ inline Bitboard Position::check_squares(PieceType pt) const { } inline bool Position::pawn_passed(Color c, Square s) const { - return !(pieces(~c, PAWN) & passed_pawn_mask(c, s)); + return !(pieces(~c, PAWN) & passed_pawn_span(c, s)); } inline bool Position::advanced_pawn_push(Move m) const { @@ -413,7 +413,7 @@ inline void Position::move_piece(Piece pc, Square from, Square to) { // index[from] is not updated and becomes stale. This works as long as index[] // is accessed just by known occupied squares. - Bitboard fromTo = SquareBB[from] ^ SquareBB[to]; + Bitboard fromTo = square_bb(from) ^ square_bb(to); byTypeBB[ALL_PIECES] ^= fromTo; byTypeBB[type_of(pc)] ^= fromTo; byColorBB[color_of(pc)] ^= fromTo;