mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Simplify a condition in gives_check()
Now that aligned() is quite fast we can skip some logic. No functional change.
This commit is contained in:
@@ -633,14 +633,11 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const {
|
|||||||
if (ci.checkSq[pt] & to)
|
if (ci.checkSq[pt] & to)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Discovery check ?
|
// Discovered check ?
|
||||||
if (unlikely(ci.dcCandidates) && (ci.dcCandidates & from))
|
if ( unlikely(ci.dcCandidates)
|
||||||
{
|
&& (ci.dcCandidates & from)
|
||||||
// For pawn and king moves we need to verify also direction
|
&& !aligned(from, to, king_square(~sideToMove)))
|
||||||
if ( (pt != PAWN && pt != KING)
|
return true;
|
||||||
|| !aligned(from, to, king_square(~sideToMove)))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Can we skip the ugly special cases ?
|
// Can we skip the ugly special cases ?
|
||||||
if (type_of(m) == NORMAL)
|
if (type_of(m) == NORMAL)
|
||||||
|
|||||||
Reference in New Issue
Block a user