X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=17a1aeab984884b261c08bd858556bcdb8884614;hp=32934393cbb1e978dd4daedddb9fb5ddd19a44eb;hb=da948cc94ebef4988199c90389a5099b087d2088;hpb=60bc30275decbb00aa26af8dc14ad6cb167eaa82 diff --git a/src/search.cpp b/src/search.cpp index 32934393..17a1aeab 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -299,6 +299,7 @@ namespace { void ponderhit(); void print_current_line(SearchStack ss[], int ply, int threadID); void wait_for_stop_or_ponderhit(); + void init_ss_array(SearchStack ss[]); void idle_loop(int threadID, SplitPoint* waitSp); void init_split_point_stack(); @@ -636,11 +637,7 @@ namespace { // Initialize TT.new_search(); H.clear(); - for (int i = 0; i < 3; i++) - { - ss[i].init(i); - ss[i].initKillers(); - } + init_ss_array(ss); IterationInfo[1] = IterationInfoType(rml.get_move_score(0), rml.get_move_score(0)); Iteration = 1; @@ -1961,6 +1958,7 @@ namespace { // Find a quick score for the move StateInfo st; SearchStack ss[PLY_MAX_PLUS_2]; + init_ss_array(ss); moves[count].move = cur->move; pos.do_move(moves[count].move, st); @@ -2560,6 +2558,18 @@ namespace { } + // init_ss_array() does a fast reset of the first entries of a SearchStack array + + void init_ss_array(SearchStack ss[]) { + + for (int i = 0; i < 3; i++) + { + ss[i].init(i); + ss[i].initKillers(); + } + } + + // wait_for_stop_or_ponderhit() is called when the maximum depth is reached // while the program is pondering. The point is to work around a wrinkle in // the UCI protocol: When pondering, the engine is not allowed to give a