From 95d24b77dfe8a147100d9753c5580563c3e642d2 Mon Sep 17 00:00:00 2001 From: Michael Chaly Date: Wed, 13 Jul 2022 11:59:54 +0300 Subject: [PATCH] Simplify away some unneeded code in time management The lower bound of the clamp is never used since complexity can't be negative and thus is unneeded. closes https://github.com/official-stockfish/Stockfish/pull/4105 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 ca1d2632..c5c7f111 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -474,7 +474,7 @@ void Thread::search() { double reduction = (1.56 + mainThread->previousTimeReduction) / (2.20 * timeReduction); double bestMoveInstability = 1 + 1.7 * totBestMoveChanges / Threads.size(); int complexity = mainThread->complexityAverage.value(); - double complexPosition = std::clamp(1.0 + (complexity - 277) / 1819.1, 0.5, 1.5); + double complexPosition = std::min(1.0 + (complexity - 277) / 1819.1, 1.5); double totalTime = Time.optimum() * fallingEval * reduction * bestMoveInstability * complexPosition; -- 2.39.2