From 259bdaaa9faf20cdc1c56faf97504f7dd2f62032 Mon Sep 17 00:00:00 2001 From: Shawn Xu Date: Sat, 31 May 2025 15:15:29 -0700 Subject: [PATCH] Remove an unnecessary bound check When failing high, it is always true that `alpha < beta` and `beta <= bestValue`. Therefore if alpha and bestValue is not in decisive range, it is guaranteed that beta is not. closes https://github.com/official-stockfish/Stockfish/pull/6115 no functional change --- src/search.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search.cpp b/src/search.cpp index b686808f..e3cb1cdb 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1412,7 +1412,7 @@ moves_loop: // When in check, search starts here assert(moveCount || !ss->inCheck || excludedMove || !MoveList(pos).size()); // Adjust best value for fail high cases - if (bestValue >= beta && !is_decisive(bestValue) && !is_decisive(beta) && !is_decisive(alpha)) + if (bestValue >= beta && !is_decisive(bestValue) && !is_decisive(alpha)) bestValue = (bestValue * depth + beta) / (depth + 1); if (!moveCount)