]> git.sesse.net Git - stockfish/commitdiff
Ensure that rootDepth < DEPTH_MAX
authorlucasart <lucas.braesch@gmail.com>
Sat, 7 Nov 2015 04:19:13 +0000 (12:19 +0800)
committerJoona Kiiski <joona@zoox.com>
Tue, 10 Nov 2015 21:41:42 +0000 (21:41 +0000)
Indeed, if we use a depth >= DEPTH_MAX, we start having negative depth in the
TT (due to int8_t cast).

No functional change in single thread mode

Resolves #490

src/search.cpp

index eb9a0891d697edd3d827556bbd5e1fbcf7ef1a15..58a52831a729c9f69cd15fd9e72210c7fea6decc 100644 (file)
@@ -386,7 +386,7 @@ void Thread::search(bool isMainThread) {
   {
       // Set up the new depth for the helper threads
       if (!isMainThread)
-          rootDepth = Threads.main()->rootDepth + Depth(int(2.2 * log(1 + this->idx)));
+          rootDepth = std::min(DEPTH_MAX - ONE_PLY, Threads.main()->rootDepth + Depth(int(2.2 * log(1 + this->idx))));
 
       // Age out PV variability metric
       if (isMainThread)
@@ -562,7 +562,7 @@ namespace {
 
     assert(-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE);
     assert(PvNode || (alpha == beta - 1));
-    assert(depth > DEPTH_ZERO);
+    assert(DEPTH_ZERO < depth && depth < DEPTH_MAX);
 
     Move pv[MAX_PLY+1], quietsSearched[64];
     StateInfo st;