]> git.sesse.net Git - stockfish/blobdiff - src/movegen.cpp
Split branches in generate_piece_moves()
[stockfish] / src / movegen.cpp
index 0598249d404e81bfa5fbb64eea5802e8dc47598d..ea3255cc3c8c91e7f309f360f12a119f3707c747 100644 (file)
@@ -429,10 +429,13 @@ namespace {
     Square from;
     const Square* ptr = pos.piece_list_begin(us, Piece);
 
-    while ((from = *ptr++) != SQ_NONE)
+    if (*ptr != SQ_NONE)
     {
-        b = pos.attacks_from<Piece>(from) & target;
-        SERIALIZE_MOVES(b);
+        do {
+            from = *ptr;
+            b = pos.attacks_from<Piece>(from) & target;
+            SERIALIZE_MOVES(b);
+        } while (*++ptr != SQ_NONE);
     }
     return mlist;
   }