X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=d59edbaeefcbf4be8ba40ea965156a21e0bf387a;hp=4f943b4c561f7394dad2ee8241bbfb60fce37c2f;hb=2c237da54647bb7526f3512bea183eb44919cdda;hpb=f907d5b7d93a161bc88aeaec403631de9de092f9 diff --git a/src/search.cpp b/src/search.cpp index 4f943b4c..d59edbae 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -85,7 +85,7 @@ namespace { // History and stats update bonus, based on depth int stat_bonus(Depth depth) { - int d = depth / ONE_PLY ; + int d = depth / ONE_PLY; return d > 17 ? 0 : d * d + 2 * d - 2; } @@ -335,7 +335,7 @@ void Thread::search() { MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr); std::memset(ss-4, 0, 7 * sizeof(Stack)); - for(int i = 4; i > 0; i--) + for (int i = 4; i > 0; i--) (ss-i)->history = &this->counterMoveHistory[NO_PIECE][0]; // Use as sentinel bestValue = delta = alpha = -VALUE_INFINITE; @@ -1256,6 +1256,9 @@ moves_loop: // When in check search starts from here { assert(is_ok(move)); + // Speculative prefetch as early as possible + prefetch(TT.first_entry(pos.key_after(move))); + givesCheck = type_of(move) == NORMAL && !pos.discovered_check_candidates() ? pos.check_squares(type_of(pos.piece_on(from_sq(move)))) & to_sq(move) : pos.gives_check(move); @@ -1297,9 +1300,6 @@ moves_loop: // When in check search starts from here && !pos.see_ge(move)) continue; - // Speculative prefetch as early as possible - prefetch(TT.first_entry(pos.key_after(move))); - // Check for legality just before making the move if (!pos.legal(move)) {