-/// Position::update_checkers() udpates chekers info given the move. It is called
-/// in do_move() and is faster then find_checkers().
-
-template<PieceType Piece>
-inline void Position::update_checkers(Bitboard* pCheckersBB, Square ksq, Square from,
- Square to, Bitboard dcCandidates) {
-
- const bool Bishop = (Piece == QUEEN || Piece == BISHOP);
- const bool Rook = (Piece == QUEEN || Piece == ROOK);
- const bool Slider = Bishop || Rook;
-
- // Direct checks
- if ( ( (Bishop && bit_is_set(BishopPseudoAttacks[ksq], to))
- || (Rook && bit_is_set(RookPseudoAttacks[ksq], to)))
- && bit_is_set(attacks_from<Piece>(ksq), to)) // slow, try to early skip
- set_bit(pCheckersBB, to);
-
- else if ( Piece != KING
- && !Slider
- && bit_is_set(Piece == PAWN ? attacks_from<PAWN>(ksq, opposite_color(sideToMove))
- : attacks_from<Piece>(ksq), to))
- set_bit(pCheckersBB, to);
-
- // Discovery checks
- if (Piece != QUEEN && bit_is_set(dcCandidates, from))
- {
- if (Piece != ROOK)
- (*pCheckersBB) |= (attacks_from<ROOK>(ksq) & pieces(ROOK, QUEEN, side_to_move()));
-
- if (Piece != BISHOP)
- (*pCheckersBB) |= (attacks_from<BISHOP>(ksq) & pieces(BISHOP, QUEEN, side_to_move()));
- }
-}
-
-