]> git.sesse.net Git - stockfish/commitdiff
Retire SearchStack init() and initKillers()
authorMarco Costalba <mcostalba@gmail.com>
Fri, 23 Jul 2010 01:42:27 +0000 (02:42 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 23 Jul 2010 01:42:27 +0000 (02:42 +0100)
Let be explicit about what this functions do, and
we save some code lines too.

No functional change.

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

index 35565d87841b083bb8527aac4c01520e98942bc3..c959c75a74b3d651486da1176a211634f8699c39 100644 (file)
@@ -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
index e2e76000793c6f890d569e6c769b680901053da5..00e2cd4ac38b0349f7063c3a7de48518df1f16d8 100644 (file)
@@ -57,9 +57,6 @@ struct SearchStack {
   Depth reduction;
   Value eval;
   bool skipNullMove;
-
-  void init();
-  void initKillers();
 };