From 9d4bf4fe0c7cb2b3e207bf50a28fed958c6ffa27 Mon Sep 17 00:00:00 2001 From: noobpwnftw Date: Sun, 27 Sep 2020 02:28:28 +0800 Subject: [PATCH] Optimize accumulators for null move. --- src/position.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 5be655be..4e47f772 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -999,21 +999,20 @@ void Position::do_null_move(StateInfo& newSt) { assert(!checkers()); assert(&newSt != st); - if (Eval::useNNUE != Eval::UseNNUEMode::False) - { - std::memcpy(&newSt, st, sizeof(StateInfo)); - } - else - std::memcpy(&newSt, st, offsetof(StateInfo, accumulator)); + std::memcpy(&newSt, st, offsetof(StateInfo, accumulator)); newSt.previous = st; st = &newSt; + // Used by NNUE + st->accumulator.computed_accumulation = false; + auto& dp = st->dirtyPiece; + dp.dirty_num = 0; + if (st->epSquare != SQ_NONE) { st->key ^= Zobrist::enpassant[file_of(st->epSquare)]; st->epSquare = SQ_NONE; - st->accumulator.computed_accumulation = false; } st->key ^= Zobrist::side;