1
0
Fork 0

Simplify a condition in gives_check()

Now that aligned() is quite fast we can skip
some logic.

No functional change.
pull/358/head
Marco Costalba 2013-12-01 10:07:16 +01:00
parent 5f2bf91ad1
commit dd4e5db2be
1 changed files with 5 additions and 8 deletions

View File

@ -633,14 +633,11 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const {
if (ci.checkSq[pt] & to)
return true;
// Discovery check ?
if (unlikely(ci.dcCandidates) && (ci.dcCandidates & from))
{
// For pawn and king moves we need to verify also direction
if ( (pt != PAWN && pt != KING)
|| !aligned(from, to, king_square(~sideToMove)))
return true;
}
// Discovered check ?
if ( unlikely(ci.dcCandidates)
&& (ci.dcCandidates & from)
&& !aligned(from, to, king_square(~sideToMove)))
return true;
// Can we skip the ugly special cases ?
if (type_of(m) == NORMAL)