mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Micro optimization of generate_piece_moves()
This patch make the piece list always terminated by SQ_NONE, so that we can use a simpler and faster loop in move generation. Speedup is about 0.6%. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -193,6 +193,7 @@ public:
|
||||
|
||||
// Piece lists
|
||||
Square piece_list(Color c, PieceType pt, int index) const;
|
||||
const Square* piece_list_begin(Color c, PieceType pt) const;
|
||||
|
||||
// Information about attacks to or from a given square
|
||||
Bitboard attackers_to(Square s) const;
|
||||
@@ -403,6 +404,10 @@ inline Square Position::piece_list(Color c, PieceType pt, int index) const {
|
||||
return pieceList[c][pt][index];
|
||||
}
|
||||
|
||||
inline const Square* Position::piece_list_begin(Color c, PieceType pt) const {
|
||||
return pieceList[c][pt];
|
||||
}
|
||||
|
||||
inline Square Position::ep_square() const {
|
||||
return st->epSquare;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user