- else if (Type == MV_NON_EVASION)
- target = pos.pieces(flip(us)) | pos.empty_squares();
-
- mlist = generate_piece_moves<PAWN, Type>(pos, mlist, us, target);
- mlist = generate_piece_moves<KNIGHT>(pos, mlist, us, target);
- mlist = generate_piece_moves<BISHOP>(pos, mlist, us, target);
- mlist = generate_piece_moves<ROOK>(pos, mlist, us, target);
- mlist = generate_piece_moves<QUEEN>(pos, mlist, us, target);
- mlist = generate_piece_moves<KING>(pos, mlist, us, target);
-
- if (Type != MV_CAPTURE && pos.can_castle(us))
- {
- mlist = generate_castle_moves<KING_SIDE>(pos, mlist, us);
- mlist = generate_castle_moves<QUEEN_SIDE>(pos, mlist, us);
- }
+ Bitboard target = Type == CAPTURES ? pos.pieces(~us)
+ : Type == QUIETS ? ~pos.pieces()
+ : Type == NON_EVASIONS ? ~pos.pieces(us) : 0;