- Bitboard b = pos.pieces_of_color_and_type(us, Piece) & not_pinned;
- while (b)
- {
- Square from = pop_1st_bit(&b);
- Bitboard bb = pos.piece_attacks<Piece>(from) & blockSquares;
- SERIALIZE_MOVES(bb);
- }
- return mlist;
- }
-
- template<>
- MoveStack* generate_piece_blocking_evasions<PAWN>(const Position& p, MoveStack* m, Color us,
- Bitboard np, Bitboard bs) {
- if (us == WHITE)
- return do_generate_pawn_blocking_evasions<WHITE, RANK_8, Rank3BB, DELTA_N>(p, np, bs, m);
- else
- return do_generate_pawn_blocking_evasions<BLACK, RANK_1, Rank6BB, DELTA_S>(p, np, bs, m);
- }
-
- 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) {
+ // Calculate our parametrized parameters at compile time
+ const Bitboard TRank8BB = (Us == WHITE ? Rank8BB : Rank1BB);
+ const Bitboard TFileABB = (Diagonal == DELTA_NE ? FileABB : FileHBB);
+ const SquareDelta TDELTA_NE = (Us == WHITE ? DELTA_NE : DELTA_SE);
+ const SquareDelta TDELTA_NW = (Us == WHITE ? DELTA_NW : DELTA_SW);
+ const SquareDelta TTDELTA_NE = (Diagonal == DELTA_NE ? TDELTA_NE : TDELTA_NW);