X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovegen.cpp;h=ea3255cc3c8c91e7f309f360f12a119f3707c747;hp=0598249d404e81bfa5fbb64eea5802e8dc47598d;hb=d9dc9dbd65263f8644afcc1fc632e9201ad20c70;hpb=be540b6dd73eab00444c068fad707e88b223d608 diff --git a/src/movegen.cpp b/src/movegen.cpp index 0598249d..ea3255cc 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -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(from) & target; - SERIALIZE_MOVES(b); + do { + from = *ptr; + b = pos.attacks_from(from) & target; + SERIALIZE_MOVES(b); + } while (*++ptr != SQ_NONE); } return mlist; }