]> git.sesse.net Git - stockfish/commitdiff
Copy 4 SearchStack items in split()
authorJoona Kiiski <joona.kiiski@gmail.com>
Fri, 5 Feb 2010 16:05:48 +0000 (18:05 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 5 Feb 2010 17:06:41 +0000 (18:06 +0100)
In search routines we use information from previous ply
and init killers two plies ahead.

So for me it seems correct to copy 4 searchstack items
in split:

ply - 1, ply, ply + 1, ply + 2

Because
a) we do not split at root (ply == 0)
b) ply < PLY_MAX and SearchStack size is PLY_MAX_PLUS_2
there should be no risk of underflows or overflows

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 07cd67047d17975fb4912121576ef2fe3985ba97..6982082252c66a0a2434e916faa32d181b3f506a 100644 (file)
@@ -3026,7 +3026,7 @@ namespace {
     for (int i = 0; i < ActiveThreads; i++)
         if (i == master || splitPoint->slaves[i])
         {
-            memcpy(splitPoint->sstack[i] + ply - 1, sstck + ply - 1, 3 * sizeof(SearchStack));
+            memcpy(splitPoint->sstack[i] + ply - 1, sstck + ply - 1, 4 * sizeof(SearchStack));
             Threads[i].workIsWaiting = true; // This makes the slave to exit from idle_loop()
         }