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:
Marco Costalba
2009-02-23 12:06:06 +01:00
parent 0bf45823da
commit da7a62852a
2 changed files with 26 additions and 9 deletions

View File

@@ -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);