Skip to content

Commit

Permalink
Ensure that rootDepth < DEPTH_MAX
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lucasart authored and zamar committed Nov 10, 2015
1 parent 9c92058 commit e6eeb17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e6eeb17

Please sign in to comment.