From: Marco Costalba Date: Sun, 19 Oct 2008 13:06:06 +0000 (+0100) Subject: Remove white/black_pawn_attacks_square() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=257689dec7a1d64658cb80d285a78e8d49141619;hp=ff211469bafcdc36c8964ae0a4b87ae277cef51a Remove white/black_pawn_attacks_square() Signed-off-by: Marco Costalba --- diff --git a/src/position.cpp b/src/position.cpp index e1d05f61..99ff223b 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -406,8 +406,8 @@ bool Position::piece_attacks_square(Square f, Square t) const { 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(f, t); case WB: case BB: return piece_attacks_square(f, t); case WR: case BR: return piece_attacks_square(f, t); @@ -668,8 +668,8 @@ bool Position::move_attacks_square(Move m, Square s) const { 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(t, s); case WB: case BB: return piece_attacks_square(t, s); case WR: case BR: return piece_attacks_square(t, s); diff --git a/src/position.h b/src/position.h index 4dcbbf76..0099ccd2 100644 --- a/src/position.h +++ b/src/position.h @@ -213,8 +213,7 @@ public: 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 Bitboard piece_attacks_square(Square f, Square t) const; // Dispatch at compile-time @@ -581,12 +580,8 @@ inline bool Position::is_check() const { 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