+ for (int i = 0, e = pos.piece_count(us, Piece); i < e; i++)
+ {
+ from = pos.piece_list(us, Piece, i);
+ b = pos.piece_attacks<Piece>(from) & target;
+ SERIALIZE_MOVES(b);
+ }
+ return mlist;
+ }
+
+ template<>
+ MoveStack* generate_piece_moves<KING>(const Position& pos, MoveStack* mlist, Color us, Bitboard target) {
+
+ Bitboard b;
+ Square from = pos.king_square(us);
+
+ b = pos.piece_attacks<KING>(from) & target;
+ SERIALIZE_MOVES(b);
+ return mlist;
+ }
+
+ template<PieceType Piece>
+ MoveStack* generate_piece_blocking_evasions(const Position& pos, Bitboard b,
+ Bitboard blockSquares, MoveStack* mlist) {
+ while (b)
+ {
+ Square from = pop_1st_bit(&b);
+ Bitboard bb = pos.piece_attacks<Piece>(from) & blockSquares;
+ SERIALIZE_MOVES(bb);
+ }
+ return mlist;
+ }
+
+
+ template<Color Us, Color Them, Bitboard TRank8BB, SquareDelta TDELTA_NE,
+ SquareDelta TDELTA_NW, SquareDelta TDELTA_N
+ >
+ MoveStack* do_generate_pawn_captures(const Position& pos, MoveStack* mlist) {
+
+ Square to;
+ Bitboard pawns = pos.pawns(Us);
+ Bitboard enemyPieces = pos.pieces_of_color(Them);