From f026517e5ee4db8dca5eb2bfd9ce7078a9d39725 Mon Sep 17 00:00:00 2001 From: Chris Caino Date: Wed, 4 Dec 2013 15:49:01 +0000 Subject: [PATCH] Micro-optimise dangerous condition Since all ENPASSANT moves are now considered dangerous, this change of order should give a slight speedup. Also simplify futilityValue formula. No functional change. --- src/search.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 23ce40f4..b8b325e5 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -807,8 +807,8 @@ moves_loop: // When in check and at SpNode search starts from here captureOrPromotion = pos.capture_or_promotion(move); givesCheck = pos.gives_check(move, ci); dangerous = givesCheck - || pos.advanced_pawn_push(move) - || type_of(move) == CASTLING; + || type_of(move) != NORMAL + || pos.advanced_pawn_push(move); // Step 12. Extend checks if (givesCheck && pos.see_sign(move) >= 0) @@ -1210,9 +1210,9 @@ moves_loop: // When in check and at SpNode search starts from here && futilityBase > -VALUE_KNOWN_WIN && !pos.advanced_pawn_push(move)) { - futilityValue = futilityBase - + PieceValue[EG][pos.piece_on(to_sq(move))] - + (type_of(move) == ENPASSANT ? PawnValueEg : VALUE_ZERO); + assert(type_of(move) != ENPASSANT); // Due to !pos.advanced_pawn_push + + futilityValue = futilityBase + PieceValue[EG][pos.piece_on(to_sq(move))]; if (futilityValue < beta) { -- 2.39.2