Skip to content

Commit

Permalink
Merge bitcoin#9200: bench: Fix subtle counting issue when rescaling i…
Browse files Browse the repository at this point in the history
…teration count

e0a9cb2 bench: Fix subtle counting issue when rescaling iteration count (Wladimir J. van der Laan)
  • Loading branch information
laanwj committed Nov 22, 2016
2 parents e4dbeb9 + e0a9cb2 commit 55b2edd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ bool State::KeepRunning()
return true;
}
if (elapsed*16 < maxElapsed) {
countMask = ((countMask<<1)|1) & ((1LL<<60)-1);
countMaskInv = 1./(countMask+1);
uint64_t newCountMask = ((countMask<<1)|1) & ((1LL<<60)-1);
if ((count & newCountMask)==0) {
countMask = newCountMask;
countMaskInv = 1./(countMask+1);
}
}
}
lastTime = now;
Expand Down

0 comments on commit 55b2edd

Please sign in to comment.