]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Remove pointless tte->static_value() != VALUE_NONE checks
[stockfish] / src / search.cpp
index ae64c4830d183e3d47c91e354269f68f1b7922b5..48c06fd3c56c29179572c0b56eb339c1973d06c1 100644 (file)
@@ -1083,8 +1083,9 @@ namespace {
     isCheck = pos.is_check();
     if (!isCheck)
     {
-        if (tte && tte->static_value() != VALUE_NONE)
+        if (tte)
         {
+            assert(tte->static_value() != VALUE_NONE);
             ss->eval = tte->static_value();
             ei.kingDanger[pos.side_to_move()] = tte->king_danger();
         }
@@ -1108,7 +1109,7 @@ namespace {
         && !pos.has_pawn_on_7th(pos.side_to_move()))
     {
         // Pass ss->eval to qsearch() and avoid an evaluate call
-        if (!tte || tte->static_value() == VALUE_NONE)
+        if (!tte)
             TT.store(posKey, ss->eval, VALUE_TYPE_EXACT, Depth(-127*OnePly), MOVE_NONE, ss->eval, ei.kingDanger[pos.side_to_move()]);
 
         Value rbeta = beta - razor_margin(depth);
@@ -1476,8 +1477,9 @@ namespace {
     }
     else
     {
-        if (tte && tte->static_value() != VALUE_NONE)
+        if (tte)
         {
+            assert(tte->static_value() != VALUE_NONE);
             ei.kingDanger[pos.side_to_move()] = tte->king_danger();
             bestValue = tte->static_value();
         }
@@ -2730,6 +2732,11 @@ namespace {
     StateInfo st;
     bool includeAllMoves = (searchMoves[0] == MOVE_NONE);
 
+    // Initialize search stack
+    init_ss_array(ss, PLY_MAX_PLUS_2);
+    ss[0].init();
+    ss[0].eval = VALUE_NONE;
+
     // Generate all legal moves
     MoveStack* last = generate_moves(pos, mlist);
 
@@ -2745,11 +2752,8 @@ namespace {
             continue;
 
         // Find a quick score for the move
-        init_ss_array(ss, PLY_MAX_PLUS_2);
-        ss[0].init();
-        ss[0].eval = VALUE_NONE;
-        ss[0].currentMove = cur->move;
         pos.do_move(cur->move, st);
+        ss[0].currentMove = cur->move;
         moves[count].move = cur->move;
         moves[count].score = -qsearch<PV>(pos, ss+1, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1);
         moves[count].pv[0] = cur->move;