Skip to content

Commit

Permalink
Merge bitcoin#9547: bench: Assert that division by zero is unreachable
Browse files Browse the repository at this point in the history
db07f91 Assert that what might look like a possible division by zero is actually unreachable (practicalswift)

Tree-SHA512: f1652eb37196a5b72f356503a1fbb44fb98aa8a94954ad1765f86d81ebf41a2337d4eb58c4f19937fda3752f5d2d642756e44afdbd438015b87ac20801246bff
  • Loading branch information
laanwj authored and PastaPastaPasta committed Feb 1, 2019
1 parent b821dfa commit a61b747
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ bool benchmark::State::KeepRunning()

--count;

assert(count != 0 && "count == 0 => (now == 0 && beginTime == 0) => return above");

// Output results
double average = (now-beginTime)/count;
int64_t averageCycles = (nowCycles-beginCycles)/count;
Expand Down

0 comments on commit a61b747

Please sign in to comment.