Speed Up Perft Search
authorbmc4 <bmc4@cin.ufpe.br>
Tue, 19 Jan 2021 12:21:59 +0000 (09:21 -0300)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 31 Jan 2021 09:04:41 +0000 (10:04 +0100)
It speeds up generate<LEGAL>, and thus perft, roughly by 2-3%.

closes https://github.com/official-stockfish/Stockfish/pull/3312

No functional change

src/movegen.cpp

index 14df1f0504d00b161b2f2ac01251dce71fe06edc..c9d6a90d7d00c191db4080c63af14a9ea6ec4e68 100644 (file)
@@ -354,7 +354,7 @@ ExtMove* generate<LEGAL>(const Position& pos, ExtMove* moveList) {
   moveList = pos.checkers() ? generate<EVASIONS    >(pos, moveList)
                             : generate<NON_EVASIONS>(pos, moveList);
   while (cur != moveList)
   moveList = pos.checkers() ? generate<EVASIONS    >(pos, moveList)
                             : generate<NON_EVASIONS>(pos, moveList);
   while (cur != moveList)
-      if (   (pinned || from_sq(*cur) == ksq || type_of(*cur) == EN_PASSANT)
+      if (  ((pinned && pinned & from_sq(*cur)) || from_sq(*cur) == ksq || type_of(*cur) == EN_PASSANT)
           && !pos.legal(*cur))
           *cur = (--moveList)->move;
       else
           && !pos.legal(*cur))
           *cur = (--moveList)->move;
       else