From 6e5a334c9502fde4a3da88a615f10181a2ab7367 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Fri, 13 Jul 2012 10:54:24 +0200 Subject: [PATCH 1/1] Remove redundant condition in is_dangerous() A pawn on 7th is always passed so retire this redundant condition. No funtional change. Signed-off-by: Marco Costalba --- src/search.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 9478ef17..4b189933 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -171,14 +171,10 @@ namespace { // 'dangerous' moves so that we avoid to prune it. FORCE_INLINE bool is_dangerous(const Position& pos, Move m, bool captureOrPromotion) { - // Test for a pawn pushed to 7th or a passed pawn move - if (type_of(pos.piece_moved(m)) == PAWN) - { - Color c = pos.side_to_move(); - if ( relative_rank(c, to_sq(m)) == RANK_7 - || pos.pawn_is_passed(c, to_sq(m))) - return true; - } + // Test for a passed pawn move + if ( type_of(pos.piece_moved(m)) == PAWN + && pos.pawn_is_passed(pos.side_to_move(), to_sq(m))) + return true; // Test for a capture that triggers a pawn endgame if ( captureOrPromotion -- 2.39.2