assert(square_is_ok(t));
switch(piece_on(f)) {
- case WP: return white_pawn_attacks_square(f, t);
- case BP: return black_pawn_attacks_square(f, t);
+ case WP: return pawn_attacks_square(WHITE, f, t);
+ case BP: return pawn_attacks_square(BLACK, f, t);
case WN: case BN: return piece_attacks_square<KNIGHT>(f, t);
case WB: case BB: return piece_attacks_square<BISHOP>(f, t);
case WR: case BR: return piece_attacks_square<ROOK>(f, t);
assert(square_is_occupied(f));
switch(piece_on(f)) {
- case WP: return white_pawn_attacks_square(t, s);
- case BP: return black_pawn_attacks_square(t, s);
+ case WP: return pawn_attacks_square(WHITE, t, s);
+ case BP: return pawn_attacks_square(BLACK, t, s);
case WN: case BN: return piece_attacks_square<KNIGHT>(t, s);
case WB: case BB: return piece_attacks_square<BISHOP>(t, s);
case WR: case BR: return piece_attacks_square<ROOK>(t, s);
Bitboard attacks_to(Square s) const;
Bitboard attacks_to(Square s, Color c) const;
bool is_check() const;
- bool white_pawn_attacks_square(Square f, Square t) const;
- bool black_pawn_attacks_square(Square f, Square t) const;
+ bool pawn_attacks_square(Color c, Square f, Square t) const;
template<PieceType>
Bitboard piece_attacks_square(Square f, Square t) const; // Dispatch at compile-time
return checkers() != EmptyBoardBB;
}
-inline bool Position::white_pawn_attacks_square(Square f, Square t) const {
- return bit_is_set(pawn_attacks(WHITE, f), t);
-}
-
-inline bool Position::black_pawn_attacks_square(Square f, Square t) const {
- return bit_is_set(pawn_attacks(BLACK, f), t);
+inline bool Position::pawn_attacks_square(Color c, Square f, Square t) const {
+ return bit_is_set(pawn_attacks(c, f), t);
}
template<PieceType Piece>