- sq = pop_1st_bit(&b1);
- (*mlist++).move = make_promotion_move(sq - TDELTA_NE, sq, ROOK);
- (*mlist++).move = make_promotion_move(sq - TDELTA_NE, sq, BISHOP);
- (*mlist++).move = make_promotion_move(sq - TDELTA_NE, sq, KNIGHT);
- }
-
- // Underpromotion captures in the h1-a8 (h8-a1 for black) direction
- b1 = (Us == WHITE ? pawns << 7 : pawns >> 9) & ~FileHBB & enemyPieces & TRank8BB;
- while (b1)
- {
- sq = pop_1st_bit(&b1);
- (*mlist++).move = make_promotion_move(sq - TDELTA_NW, sq, ROOK);
- (*mlist++).move = make_promotion_move(sq - TDELTA_NW, sq, BISHOP);
- (*mlist++).move = make_promotion_move(sq - TDELTA_NW, sq, KNIGHT);
- }
-
- // Single pawn pushes
- b1 = (Us == WHITE ? pawns << 8 : pawns >> 8) & emptySquares;
- b2 = b1 & TRank8BB;
- while (b2)
- {
- sq = pop_1st_bit(&b2);
- (*mlist++).move = make_promotion_move(sq - TDELTA_N, sq, ROOK);
- (*mlist++).move = make_promotion_move(sq - TDELTA_N, sq, BISHOP);
- (*mlist++).move = make_promotion_move(sq - TDELTA_N, sq, KNIGHT);
- }
- b2 = b1 & ~TRank8BB;
- while (b2)
- {
- sq = pop_1st_bit(&b2);
- (*mlist++).move = make_move(sq - TDELTA_N, sq);
- }
-
- // Double pawn pushes
- b2 = (Us == WHITE ? (b1 & TRank3BB) << 8 : (b1 & TRank3BB) >> 8) & emptySquares;
- while (b2)
- {
- sq = pop_1st_bit(&b2);
- (*mlist++).move = make_move(sq - TDELTA_N - TDELTA_N, sq);
- }
- return mlist;
- }
-
-
- template<Color Us, Color Them, Bitboard TRank8BB, Bitboard TRank3BB, SquareDelta TDELTA_N>
- MoveStack* do_generate_pawn_checks(const Position& pos, Bitboard dc, Square ksq, MoveStack* mlist)
- {
- // Pawn moves which give discovered check. This is possible only if the
- // pawn is not on the same file as the enemy king, because we don't
- // generate captures.
- Bitboard empty = pos.empty_squares();