From: Marco Costalba Date: Sun, 1 Dec 2013 09:07:16 +0000 (+0100) Subject: Simplify a condition in gives_check() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=dd4e5db2be2eb5631d739af634cb33bea2f3fddd;ds=sidebyside Simplify a condition in gives_check() Now that aligned() is quite fast we can skip some logic. No functional change. --- diff --git a/src/position.cpp b/src/position.cpp index d141b488..2f3c62f5 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -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)