mirror of
https://github.com/sockspls/badfish
synced 2025-05-03 18:19:35 +00:00
Microptimize gives_check() for castling case
Without patch we have 333198 nps, with patch 334249. A very small +0.3%, not a lot manily becuase this is a side path that is taken very few times. Anyhow idea is correct becuase first 'quick' condition has an hit rate of about 95%. No functional change.
This commit is contained in:
parent
ee5514b8fd
commit
1a8f63a896
1 changed files with 2 additions and 2 deletions
|
@ -690,9 +690,9 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
||||||
Square rfrom = to; // 'King captures the rook' notation
|
Square rfrom = to; // 'King captures the rook' notation
|
||||||
Square kto = relative_square(us, rfrom > kfrom ? SQ_G1 : SQ_C1);
|
Square kto = relative_square(us, rfrom > kfrom ? SQ_G1 : SQ_C1);
|
||||||
Square rto = relative_square(us, rfrom > kfrom ? SQ_F1 : SQ_D1);
|
Square rto = relative_square(us, rfrom > kfrom ? SQ_F1 : SQ_D1);
|
||||||
Bitboard b = (pieces() ^ kfrom ^ rfrom) | rto | kto;
|
|
||||||
|
|
||||||
return attacks_bb<ROOK>(rto, b) & ksq;
|
return (PseudoAttacks[ROOK][rto] & ksq)
|
||||||
|
&& (attacks_bb<ROOK>(rto, (pieces() ^ kfrom ^ rfrom) | rto | kto) & ksq);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue