Skip to content

Commit 698c069

Browse files
pb00068Disservin
authored andcommitted
Move node increment inside do_move function
Move node increment inside do_move function so that we can centralize the increment into a single point. closes #5989 No functional change
1 parent 2b4926e commit 698c069

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/search.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ void Search::Worker::do_move(Position& pos, const Move move, StateInfo& st) {
556556

557557
void Search::Worker::do_move(Position& pos, const Move move, StateInfo& st, const bool givesCheck) {
558558
DirtyPiece dp = pos.do_move(move, st, givesCheck, &tt);
559+
nodes.fetch_add(1, std::memory_order_relaxed);
559560
accumulatorStack.push(dp);
560561
}
561562

@@ -940,7 +941,6 @@ Value Search::Worker::search(
940941
movedPiece = pos.moved_piece(move);
941942

942943
do_move(pos, move, st);
943-
thisThread->nodes.fetch_add(1, std::memory_order_relaxed);
944944

945945
ss->currentMove = move;
946946
ss->isTTMove = (move == ttData.move);
@@ -1193,7 +1193,6 @@ Value Search::Worker::search(
11931193

11941194
// Step 16. Make the move
11951195
do_move(pos, move, st, givesCheck);
1196-
thisThread->nodes.fetch_add(1, std::memory_order_relaxed);
11971196

11981197
// Add extension to new depth
11991198
newDepth += extension;
@@ -1711,7 +1710,6 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
17111710
Piece movedPiece = pos.moved_piece(move);
17121711

17131712
do_move(pos, move, st, givesCheck);
1714-
thisThread->nodes.fetch_add(1, std::memory_order_relaxed);
17151713

17161714
// Update the current move
17171715
ss->currentMove = move;

0 commit comments

Comments
 (0)