Skip to content

Commit 55b2edd

Browse files
committed
Merge #9200: bench: Fix subtle counting issue when rescaling iteration count
e0a9cb2 bench: Fix subtle counting issue when rescaling iteration count (Wladimir J. van der Laan)
2 parents e4dbeb9 + e0a9cb2 commit 55b2edd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bench/bench.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ bool State::KeepRunning()
6464
return true;
6565
}
6666
if (elapsed*16 < maxElapsed) {
67-
countMask = ((countMask<<1)|1) & ((1LL<<60)-1);
68-
countMaskInv = 1./(countMask+1);
67+
uint64_t newCountMask = ((countMask<<1)|1) & ((1LL<<60)-1);
68+
if ((count & newCountMask)==0) {
69+
countMask = newCountMask;
70+
countMaskInv = 1./(countMask+1);
71+
}
6972
}
7073
}
7174
lastTime = now;

0 commit comments

Comments
 (0)