X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=5a4c594df8e3d7055f196ed430cd1fd1f9320aeb;hp=bebf617f4f039cc959c2a0d41799cbaf323ef234;hb=9518cc3254972ca174a028487d9fe39241101e93;hpb=de1dc4f2de7d22c9ea1b33b9caee276651ef7c6d diff --git a/src/position.h b/src/position.h index bebf617f..5a4c594d 100644 --- a/src/position.h +++ b/src/position.h @@ -113,8 +113,8 @@ public: Square king_square(Color c) const; Square ep_square() const; bool is_empty(Square s) const; - const Square* piece_list(Color c, PieceType pt) const; - int piece_count(Color c, PieceType pt) const; + template int count(Color c) const; + template const Square* list(Color c) const; // Castling int can_castle(CastleRight f) const; @@ -193,7 +193,7 @@ private: // Helper functions void do_castle(Square kfrom, Square kto, Square rfrom, Square rto); - template Bitboard hidden_checkers() const; + Bitboard hidden_checkers(Square ksq, Color c) const; // Computing hash keys from scratch (for initialization and debugging) Key compute_key() const; @@ -273,12 +273,12 @@ inline Bitboard Position::pieces(Color c, PieceType pt1, PieceType pt2) const { return byColorBB[c] & (byTypeBB[pt1] | byTypeBB[pt2]); } -inline int Position::piece_count(Color c, PieceType pt) const { - return pieceCount[c][pt]; +template inline int Position::count(Color c) const { + return pieceCount[c][Pt]; } -inline const Square* Position::piece_list(Color c, PieceType pt) const { - return pieceList[c][pt]; +template inline const Square* Position::list(Color c) const { + return pieceList[c][Pt]; } inline Square Position::ep_square() const { @@ -331,11 +331,11 @@ inline Bitboard Position::checkers() const { } inline Bitboard Position::discovered_check_candidates() const { - return hidden_checkers(); + return hidden_checkers(king_square(~sideToMove), sideToMove); } inline Bitboard Position::pinned_pieces() const { - return hidden_checkers(); + return hidden_checkers(king_square(sideToMove), ~sideToMove); } inline bool Position::pawn_is_passed(Color c, Square s) const {