X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovegen.cpp;h=cc1518a078de7d48064e93cbd23e8ad6b95b54be;hp=d74df4c32cf847f9b7ee50c64e7a7da333ef9914;hb=2c1be0be8ec51005befcd4fc422e88b6e32cef45;hpb=84f3e867903f62480c33243dd0ecbffd342796fc diff --git a/src/movegen.cpp b/src/movegen.cpp index d74df4c3..cc1518a0 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -180,10 +180,11 @@ namespace { static_assert(Pt != KING && Pt != PAWN, "Unsupported piece type in generate_moves()"); - const Square* pl = pos.squares(Us); + Bitboard bb = pos.pieces(Us, Pt); + + while (bb) { + Square from = pop_lsb(&bb); - for (Square from = *pl; from != SQ_NONE; from = *++pl) - { if (Checks) { if ( (Pt == BISHOP || Pt == ROOK || Pt == QUEEN) @@ -248,7 +249,7 @@ namespace { *moveList++ = make_move(ksq, pop_lsb(&b)); if ((Type != CAPTURES) && pos.can_castle(Us & ANY_CASTLING)) - for(CastlingRights cr : { Us & KING_SIDE, Us & QUEEN_SIDE } ) + for (CastlingRights cr : { Us & KING_SIDE, Us & QUEEN_SIDE } ) if (!pos.castling_impeded(cr) && pos.can_castle(cr)) *moveList++ = make(ksq, pos.castling_rook_square(cr)); }