X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=fc9e23c91a9342d635d33e9c7a18da0215742cf6;hp=67680b1fbac52c46360109abdabbd6bcf585863a;hb=772a37cd54212a7b045781b69eb190bd5d4e3161;hpb=c02613860a3836bb85da25ae2fed9f1351ba27a5 diff --git a/src/position.cpp b/src/position.cpp index 67680b1f..fc9e23c9 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -707,10 +707,17 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) { assert(is_ok()); assert(move_is_ok(m)); - // Copy some fields of old state to our new StateInfo object (except the - // captured piece, which is taken care of later) and switch state pointer - // to point to the new, ready to be updated, state. - newSt = *st; + // Copy some fields of old state to our new StateInfo object except the + // ones which are recalculated from scratch anyway, then switch our state + // pointer to point to the new, ready to be updated, state. + struct ReducedStateInfo { + Key key, pawnKey, materialKey; + int castleRights, rule50; + Square epSquare; + Value mgValue, egValue; + }; + + memcpy(&newSt, st, sizeof(ReducedStateInfo)); newSt.capture = NO_PIECE_TYPE; newSt.previous = st; st = &newSt;