]> git.sesse.net Git - stockfish/blobdiff - src/thread.cpp
Use popcount intrinsic with Interl compiler
[stockfish] / src / thread.cpp
index dc4ec05e2f586607453270181e6cd9e7bbe841d6..4dc7d9e9b02aa565a56dd626155c706baf5893ad 100644 (file)
@@ -190,6 +190,8 @@ void ThreadPool::start_thinking(const Position& pos, StateListPtr& states,
   if (states.get())
       setupStates = std::move(states); // Ownership transfer, states is now empty
 
+  StateInfo tmp = setupStates->back();
+
   for (Thread* th : Threads)
   {
       th->maxPly = 0;
@@ -198,5 +200,7 @@ void ThreadPool::start_thinking(const Position& pos, StateListPtr& states,
       th->rootPos.set(pos.fen(), pos.is_chess960(), &setupStates->back(), th);
   }
 
+  setupStates->back() = tmp; // Restore st->previous, cleared by Position::set()
+
   main()->start_searching();
 }