mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Do not copy the whole old state in do_move()
Instead of copy the old state in the new one, copy only fields that will be updated incrementally, not the ones that will be recalculcated anyway. This let us copy 13 bytes instead of 28 for each do_move() call. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -83,10 +83,10 @@ struct StateInfo {
|
||||
Key key, pawnKey, materialKey;
|
||||
int castleRights, rule50;
|
||||
Square epSquare;
|
||||
Move lastMove;
|
||||
Value mgValue, egValue;
|
||||
PieceType capture;
|
||||
StateInfo* previous;
|
||||
Move lastMove;
|
||||
};
|
||||
|
||||
|
||||
@@ -294,6 +294,7 @@ private:
|
||||
void allow_ooo(Color c);
|
||||
|
||||
// Helper functions for doing and undoing moves
|
||||
void init_new_state(StateInfo& newSt);
|
||||
void do_capture_move(Move m, PieceType capture, Color them, Square to);
|
||||
void do_castle_move(Move m);
|
||||
void do_promotion_move(Move m);
|
||||
|
||||
Reference in New Issue
Block a user