]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Silence idiotic warning on two's complement of an unsigned
[stockfish] / src / search.cpp
index 022f3a9d15b8a08a5c78483490156051e4f732d7..806a9be135e40237c1865987258b008f48efe19a 100644 (file)
@@ -258,7 +258,7 @@ namespace {
                 Depth depth, int ply, int threadID);
   void sp_search(SplitPoint *sp, int threadID);
   void sp_search_pv(SplitPoint *sp, int threadID);
-  void init_node(const Position &pos, SearchStack ss[], int ply, int threadID);
+  void init_node(SearchStack ss[], int ply, int threadID);
   void update_pv(SearchStack ss[], int ply);
   void sp_update_pv(SearchStack *pss, SearchStack ss[], int ply);
   bool connected_moves(const Position &pos, Move m1, Move m2);
@@ -959,7 +959,7 @@ namespace {
 
     // Initialize, and make an early exit in case of an aborted search,
     // an instant draw, maximum ply reached, etc.
-    init_node(pos, ss, ply, threadID);
+    init_node(ss, ply, threadID);
 
     // After init_node() that calls poll()
     if (AbortSearch || thread_should_stop(threadID))
@@ -1155,7 +1155,7 @@ namespace {
 
     // Initialize, and make an early exit in case of an aborted search,
     // an instant draw, maximum ply reached, etc.
-    init_node(pos, ss, ply, threadID);
+    init_node(ss, ply, threadID);
 
     // After init_node() that calls poll()
     if (AbortSearch || thread_should_stop(threadID))
@@ -1424,7 +1424,7 @@ namespace {
 
     // Initialize, and make an early exit in case of an aborted search,
     // an instant draw, maximum ply reached, etc.
-    init_node(pos, ss, ply, threadID);
+    init_node(ss, ply, threadID);
 
     // After init_node() that calls poll()
     if (AbortSearch || thread_should_stop(threadID))
@@ -1451,18 +1451,18 @@ namespace {
     EvalInfo ei;
     Value staticValue;
     bool isCheck = pos.is_check();
+    ei.futilityMargin = Value(0); // Manually initialize futilityMargin
 
     if (isCheck)
         staticValue = -VALUE_INFINITE;
 
-    else if (tte && (tte->type() == VALUE_TYPE_EVAL || tte->staticValue()))
+    else if (tte && tte->type() == VALUE_TYPE_EVAL)
     {
         // Use the cached evaluation score if possible
         assert(tte->value() == evaluate(pos, ei, threadID));
         assert(ei.futilityMargin == Value(0));
 
         staticValue = tte->value();
-        ei.futilityMargin = Value(0); // manually initialize futilityMargin
     }
     else
         staticValue = evaluate(pos, ei, threadID);
@@ -1569,21 +1569,10 @@ namespace {
     if (!pvNode)
     {
         Depth d = (depth == Depth(0) ? Depth(0) : Depth(-1));
-        Value v = value_to_tt(bestValue, ply);
-        TTEntry* e;
         if (bestValue < beta)
-            e = TT.store(pos, v, d, MOVE_NONE, VALUE_TYPE_UPPER);
+            TT.store(pos, value_to_tt(bestValue, ply), d, MOVE_NONE, VALUE_TYPE_UPPER);
         else
-            e = TT.store(pos, v, d, MOVE_NONE, VALUE_TYPE_LOWER);
-
-        assert(e && e == TT.retrieve(pos));
-        assert(!e->staticValue());
-
-        // If the just stored value happens to be equal to the static evaluation
-        // score then set the flag, so to avoid calling evaluation() next time we
-        // hit this position.
-        if (staticValue == v && !ei.futilityMargin)
-            e->setStaticValue();
+            TT.store(pos, value_to_tt(bestValue, ply), d, MOVE_NONE, VALUE_TYPE_LOWER);
     }
 
     // Update killers only for good check moves
@@ -2036,7 +2025,7 @@ namespace {
   // NodesBetweenPolls nodes, init_node() also calls poll(), which polls
   // for user input and checks whether it is time to stop the search.
 
-  void init_node(const Position &pos, SearchStack ss[], int ply, int threadID) {
+  void init_node(SearchStack ss[], int ply, int threadID) {
     assert(ply >= 0 && ply < PLY_MAX);
     assert(threadID >= 0 && threadID < ActiveThreads);