mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Small update_checkers() cleanup
And is a bit faster too. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
8a116ce691
commit
f7f09b91ea
1 changed files with 9 additions and 11 deletions
|
@ -658,20 +658,18 @@ inline void Position::update_checkers(Bitboard* pCheckersBB, Square ksq, Square
|
||||||
const bool Rook = (Piece == QUEEN || Piece == ROOK);
|
const bool Rook = (Piece == QUEEN || Piece == ROOK);
|
||||||
const bool Slider = Bishop || Rook;
|
const bool Slider = Bishop || Rook;
|
||||||
|
|
||||||
|
assert(*pCheckersBB == EmptyBoardBB);
|
||||||
|
|
||||||
// Direct checks
|
// Direct checks
|
||||||
if ( ( (Bishop && bit_is_set(BishopPseudoAttacks[ksq], to))
|
if ( ( !Slider // try to early skip slide piece attacks
|
||||||
|
|| (Bishop && bit_is_set(BishopPseudoAttacks[ksq], to))
|
||||||
|| (Rook && bit_is_set(RookPseudoAttacks[ksq], to)))
|
|| (Rook && bit_is_set(RookPseudoAttacks[ksq], to)))
|
||||||
&& bit_is_set(attacks_from<Piece>(ksq), to)) // slow, try to early skip
|
&& bit_is_set(Piece == PAWN ? attacks_from<PAWN>(ksq, opposite_color(sideToMove)) : attacks_from<Piece>(ksq) , to))
|
||||||
set_bit(pCheckersBB, to);
|
{
|
||||||
|
*pCheckersBB = SetMaskBB[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
|
// Discovery checks
|
||||||
if (Piece != QUEEN && bit_is_set(dcCandidates, from))
|
if (Piece != QUEEN && dcCandidates && bit_is_set(dcCandidates, from))
|
||||||
{
|
{
|
||||||
if (Piece != ROOK)
|
if (Piece != ROOK)
|
||||||
(*pCheckersBB) |= (attacks_from<ROOK>(ksq) & pieces(ROOK, QUEEN, side_to_move()));
|
(*pCheckersBB) |= (attacks_from<ROOK>(ksq) & pieces(ROOK, QUEEN, side_to_move()));
|
||||||
|
|
Loading…
Add table
Reference in a new issue