X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=2f83f4f45b017fa7a9bfde67c155c28dbcc431a4;hp=d1dc4489133387df5d0545f5277b6b0ebd9bd3ae;hb=615d98da2447e79ceceae205e0cd4e878115acc3;hpb=84f3e867903f62480c33243dd0ecbffd342796fc diff --git a/src/search.cpp b/src/search.cpp index d1dc4489..2f83f4f4 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -986,6 +986,10 @@ moves_loop: // When in check, search starts from here thisThread->rootMoves.begin() + thisThread->pvLast, move)) continue; + // Check for legality + if (!rootNode && !pos.legal(move)) + continue; + ss->moveCount = ++moveCount; if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000) @@ -1137,13 +1141,6 @@ moves_loop: // When in check, search starts from here // Speculative prefetch as early as possible prefetch(TT.first_entry(pos.key_after(move))); - // Check for legality just before making the move - if (!rootNode && !pos.legal(move)) - { - ss->moveCount = --moveCount; - continue; - } - // Update the current move (this must be done after singular extension search) ss->currentMove = move; ss->continuationHistory = &thisThread->continuationHistory[ss->inCheck]