From a52ab2afbf38e42376732d41b14279fd29fcf23f Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 18 Apr 2009 16:21:44 +0100 Subject: [PATCH] Micro optimize generate_piece_checks() Avoid calculating piece attacks if there aren't available check sqaures for the given piece. About 15% of cases. Not a biggie but still something especially in the middle game where king is well covered inside his castle. No functional change. Signed-off-by: Marco Costalba --- src/movegen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/movegen.cpp b/src/movegen.cpp index 0f2f6b4e..d2b55bd2 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -815,6 +815,9 @@ namespace { return mlist; Bitboard checkSqs = pos.piece_attacks(ksq) & pos.empty_squares(); + if (!checkSqs) + return mlist; + while (b) { Square from = pop_1st_bit(&b); -- 2.39.2