From: Marco Costalba Date: Fri, 23 Jul 2010 01:42:27 +0000 (+0100) Subject: Retire SearchStack init() and initKillers() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=d5520977b978ded0cb9d69ff4c35a251c69216cc Retire SearchStack init() and initKillers() Let be explicit about what this functions do, and we save some code lines too. No functional change. Signed-off-by: Marco Costalba --- diff --git a/src/search.cpp b/src/search.cpp index 35565d87..c959c75a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -360,20 +360,6 @@ void init_search() { } -// SearchStack::init() initializes a search stack entry. -// Called at the beginning of search() when starting to examine a new node. -void SearchStack::init() { - - currentMove = bestMove = MOVE_NONE; -} - -// SearchStack::initKillers() initializes killers for a search stack entry -void SearchStack::initKillers() { - - killers[0] = killers[1] = mateKiller = MOVE_NONE; -} - - /// perft() is our utility to verify move generation is bug free. All the legal /// moves up to given depth are generated and counted and the sum returned. @@ -763,7 +749,7 @@ namespace { isCheck = pos.is_check(); // Step 1. Initialize node (polling is omitted at root) - ss->init(); + ss->currentMove = ss->bestMove = MOVE_NONE; // Step 2. Check for aborted search (omitted at root) // Step 3. Mate distance pruning (omitted at root) @@ -1018,7 +1004,7 @@ namespace { StateInfo st; const TTEntry* tte; Key posKey; - Move ttMove, move, excludedMove; + Move ttMove, move, excludedMove, threatMove; Depth ext, newDepth; Value bestValue, value, oldAlpha; Value refinedValue, nullValue, futilityValueScaled; // Non-PV specific @@ -1026,14 +1012,13 @@ namespace { bool mateThreat = false; int moveCount = 0; int threadID = pos.thread(); - Move threatMove = MOVE_NONE; refinedValue = bestValue = value = -VALUE_INFINITE; oldAlpha = alpha; // Step 1. Initialize node and poll. Polling can abort search TM.incrementNodeCounter(threadID); - ss->init(); - (ss+2)->initKillers(); + ss->currentMove = ss->bestMove = threatMove = MOVE_NONE; + (ss+2)->killers[0] = (ss+2)->killers[1] = (ss+2)->mateKiller = MOVE_NONE; if (threadID == 0 && ++NodesSincePoll > NodesBetweenPolls) { @@ -2214,7 +2199,7 @@ namespace { ss->reduction = Depth(0); if (i < 3) - ss->initKillers(); + ss->killers[0] = ss->killers[1] = ss->mateKiller = MOVE_NONE; } } @@ -2792,7 +2777,7 @@ namespace { // Initialize search stack init_ss_array(ss, PLY_MAX_PLUS_2); - ss[0].init(); + ss[0].currentMove = ss[0].bestMove = MOVE_NONE; ss[0].eval = VALUE_NONE; // Generate all legal moves diff --git a/src/search.h b/src/search.h index e2e76000..00e2cd4a 100644 --- a/src/search.h +++ b/src/search.h @@ -57,9 +57,6 @@ struct SearchStack { Depth reduction; Value eval; bool skipNullMove; - - void init(); - void initKillers(); };