X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmovegen.cpp;h=ea3255cc3c8c91e7f309f360f12a119f3707c747;hb=7305b569579e02d5e40d8ed981b93a03a6622868;hp=0598249d404e81bfa5fbb64eea5802e8dc47598d;hpb=be540b6dd73eab00444c068fad707e88b223d608;p=stockfish 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; }