mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Avoid to call useless sliders attacks in update_checkers()
Quickly filter out some calls to sliders attacks when we already know that will fail for sure. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
68e711aac6
commit
7c84b39a42
1 changed files with 12 additions and 1 deletions
|
@ -648,7 +648,18 @@ template<PieceType Piece>
|
|||
inline void Position::update_checkers(Bitboard* pCheckersBB, Square ksq, Square from,
|
||||
Square to, Bitboard dcCandidates) {
|
||||
|
||||
if (Piece != KING && bit_is_set(piece_attacks<Piece>(ksq), to))
|
||||
const bool Bishop = (Piece == QUEEN || Piece == BISHOP);
|
||||
const bool Rook = (Piece == QUEEN || Piece == ROOK);
|
||||
const bool Slider = Bishop || Rook;
|
||||
|
||||
if ( ( (Bishop && bit_is_set(BishopPseudoAttacks[ksq], to))
|
||||
|| (Rook && bit_is_set(RookPseudoAttacks[ksq], to)))
|
||||
&& bit_is_set(piece_attacks<Piece>(ksq), to)) // slow, try to early skip
|
||||
set_bit(pCheckersBB, to);
|
||||
|
||||
else if ( Piece != KING
|
||||
&& !Slider
|
||||
&& bit_is_set(piece_attacks<Piece>(ksq), to))
|
||||
set_bit(pCheckersBB, to);
|
||||
|
||||
if (Piece != QUEEN && bit_is_set(dcCandidates, from))
|
||||
|
|
Loading…
Add table
Reference in a new issue