]> git.sesse.net Git - stockfish/blobdiff - src/movegen.cpp
Revert _BitScanForward64 support
[stockfish] / src / movegen.cpp
index cbb71688d20a6c9eaa11475e4e9aa505ffdc2d18..1135c21976f416a9bf0116f0936972dc9bde2afe 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <cassert>
 
+#include "bitcount.h"
 #include "movegen.h"
 
 // Simple macro to wrap a very common while loop, no facny, no flexibility,
@@ -835,23 +836,23 @@ namespace {
 
     // Direct checks
     b = target & ~dc;
-    if (Piece == KING || !b)
-        return mlist;
-
-    Bitboard checkSqs = pos.piece_attacks<Piece>(ksq) & pos.empty_squares();
-    if (!checkSqs)
-        return mlist;
-
-    while (b)
+    if (Piece != KING || b)
     {
-        Square from = pop_1st_bit(&b);
-        if (   (Piece == QUEEN  && !(QueenPseudoAttacks[from]  & checkSqs))
-            || (Piece == ROOK   && !(RookPseudoAttacks[from]   & checkSqs))
-            || (Piece == BISHOP && !(BishopPseudoAttacks[from] & checkSqs)))
-            continue;
+        Bitboard checkSqs = pos.piece_attacks<Piece>(ksq) & pos.empty_squares();
+        if (!checkSqs)
+            return mlist;
 
-        Bitboard bb = pos.piece_attacks<Piece>(from) & checkSqs;
-        SERIALIZE_MOVES(bb);
+        while (b)
+        {
+            Square from = pop_1st_bit(&b);
+            if (   (Piece == QUEEN  && !(QueenPseudoAttacks[from]  & checkSqs))
+                || (Piece == ROOK   && !(RookPseudoAttacks[from]   & checkSqs))
+                || (Piece == BISHOP && !(BishopPseudoAttacks[from] & checkSqs)))
+                continue;
+
+            Bitboard bb = pos.piece_attacks<Piece>(from) & checkSqs;
+            SERIALIZE_MOVES(bb);
+        }
     }
     return mlist;
   }