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
This commit is contained in:
Shawn Xu
2025-05-31 15:15:29 -07:00
committed by Joost VandeVondele
parent c9af7674bc
commit 259bdaaa9f

View File

@@ -1412,7 +1412,7 @@ moves_loop: // When in check, search starts here
assert(moveCount || !ss->inCheck || excludedMove || !MoveList<LEGAL>(pos).size()); assert(moveCount || !ss->inCheck || excludedMove || !MoveList<LEGAL>(pos).size());
// Adjust best value for fail high cases // 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); bestValue = (bestValue * depth + beta) / (depth + 1);
if (!moveCount) if (!moveCount)