From: lucasart Date: Sat, 7 Nov 2015 04:19:13 +0000 (+0800) Subject: Ensure that rootDepth < DEPTH_MAX X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=e6eeb17aa6a79ab49b6c70fb783f54318d63add7;hp=9c9205860c5ab0e4f3180298e3f7082be259772c Ensure that rootDepth < DEPTH_MAX 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 --- diff --git a/src/search.cpp b/src/search.cpp index eb9a0891..58a52831 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -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;