]> git.sesse.net Git - stockfish/commitdiff
Faster handling of king captures in Position::see
authorHenri Wiechers <hwiechers@gmail.com>
Sat, 8 Feb 2014 05:46:46 +0000 (07:46 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 9 Feb 2014 18:42:24 +0000 (19:42 +0100)
Another SEE speed up that passed the SPRT short TC test!

LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 81337 W: 15060 L: 14745 D: 51532

No functional change.

src/position.cpp

index 8f38493027b07e9f8c273ae95d73f046ea8026b3..6f8747635772aa930a604025bd5b0c95a67dbbc2 100644 (file)
@@ -1080,13 +1080,18 @@ int Position::see(Move m) const {
 
       // Locate and remove the next least valuable attacker
       captured = min_attacker<PAWN>(byTypeBB, to, stmAttackers, occupied, attackers);
 
       // Locate and remove the next least valuable attacker
       captured = min_attacker<PAWN>(byTypeBB, to, stmAttackers, occupied, attackers);
-      stm = ~stm;
-      stmAttackers = attackers & pieces(stm);
 
       // Stop before processing a king capture
 
       // Stop before processing a king capture
-      if (captured == KING && stmAttackers)
+      if (captured == KING)
+      {
+          if (stmAttackers == attackers)
+              ++slIndex;
+
           break;
           break;
+      }
 
 
+      stm = ~stm;
+      stmAttackers = attackers & pieces(stm);
       ++slIndex;
 
   } while (stmAttackers);
       ++slIndex;
 
   } while (stmAttackers);