]> git.sesse.net Git - stockfish/blobdiff - src/position.cpp
Micro-optimize SEE
[stockfish] / src / position.cpp
index cc320b4b3e45d55aba64cbc2194f71795ba5d35f..8d4b9f4f3c53de66f382dee30529aa46986ae91e 100644 (file)
@@ -1098,21 +1098,11 @@ Value Position::see(Move m) const {
 
       // Locate and remove the next least valuable attacker
       captured = min_attacker<PAWN>(byTypeBB, to, stmAttackers, occupied, attackers);
-
-      // Stop before processing a king capture
-      if (captured == KING)
-      {
-          if (stmAttackers == attackers)
-              ++slIndex;
-
-          break;
-      }
-
       stm = ~stm;
       stmAttackers = attackers & pieces(stm);
       ++slIndex;
 
-  } while (stmAttackers);
+  } while (stmAttackers && (captured != KING || (--slIndex, false))); // Stop before a king capture
 
   // Having built the swap list, we negamax through it to find the best
   // achievable score from the point of view of the side to move.