mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Convert also generate_pawn_blocking_evasions() to new API
New compact parameter passing API. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
9fbe9af0a0
commit
be4ee0729d
1 changed files with 12 additions and 7 deletions
|
@ -53,7 +53,7 @@ namespace {
|
||||||
template<CastlingSide Side>
|
template<CastlingSide Side>
|
||||||
MoveStack* generate_castle_moves(const Position& pos, MoveStack* mlist);
|
MoveStack* generate_castle_moves(const Position& pos, MoveStack* mlist);
|
||||||
|
|
||||||
template<Color Us, Rank, Bitboard, SquareDelta>
|
template<Color Us>
|
||||||
MoveStack* generate_pawn_blocking_evasions(const Position&, Bitboard, Bitboard, MoveStack*);
|
MoveStack* generate_pawn_blocking_evasions(const Position&, Bitboard, Bitboard, MoveStack*);
|
||||||
|
|
||||||
template<Color Us>
|
template<Color Us>
|
||||||
|
@ -118,10 +118,9 @@ namespace {
|
||||||
template<>
|
template<>
|
||||||
inline MoveStack* generate_piece_moves<PAWN>(const Position& p, MoveStack* m,
|
inline MoveStack* generate_piece_moves<PAWN>(const Position& p, MoveStack* m,
|
||||||
Color us, Bitboard t, Bitboard pnd) {
|
Color us, Bitboard t, Bitboard pnd) {
|
||||||
if (us == WHITE)
|
|
||||||
return generate_pawn_blocking_evasions<WHITE, RANK_8, Rank3BB, DELTA_N>(p, pnd, t, m);
|
return (us == WHITE ? generate_pawn_blocking_evasions<WHITE>(p, pnd, t, m)
|
||||||
else
|
: generate_pawn_blocking_evasions<BLACK>(p, pnd, t, m));
|
||||||
return generate_pawn_blocking_evasions<BLACK, RANK_1, Rank6BB, DELTA_S>(p, pnd, t, m);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -850,9 +849,15 @@ namespace {
|
||||||
return mlist;
|
return mlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Color Us, Rank TRANK_8, Bitboard TRank3BB, SquareDelta TDELTA_N>
|
template<Color Us>
|
||||||
MoveStack* generate_pawn_blocking_evasions(const Position& pos, Bitboard pinned,
|
MoveStack* generate_pawn_blocking_evasions(const Position& pos, Bitboard pinned,
|
||||||
Bitboard blockSquares, MoveStack* mlist) {
|
Bitboard blockSquares, MoveStack* mlist) {
|
||||||
|
|
||||||
|
// Calculate our parametrized parameters at compile time
|
||||||
|
const Bitboard TRank8BB = (Us == WHITE ? Rank8BB : Rank1BB);
|
||||||
|
const Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);
|
||||||
|
const SquareDelta TDELTA_N = (Us == WHITE ? DELTA_N : DELTA_S);
|
||||||
|
|
||||||
Square to;
|
Square to;
|
||||||
|
|
||||||
// Find non-pinned pawns and push them one square
|
// Find non-pinned pawns and push them one square
|
||||||
|
@ -867,7 +872,7 @@ namespace {
|
||||||
|
|
||||||
assert(pos.piece_on(to) == EMPTY);
|
assert(pos.piece_on(to) == EMPTY);
|
||||||
|
|
||||||
if (square_rank(to) == TRANK_8)
|
if (square_rank(to) == TRank8BB)
|
||||||
{
|
{
|
||||||
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, QUEEN);
|
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, QUEEN);
|
||||||
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, ROOK);
|
(*mlist++).move = make_promotion_move(to - TDELTA_N, to, ROOK);
|
||||||
|
|
Loading…
Add table
Reference in a new issue