Skip to content

Commit d32581c

Browse files
committed
Merge #9547: bench: Assert that division by zero is unreachable
db07f91 Assert that what might look like a possible division by zero is actually unreachable (practicalswift) Tree-SHA512: f1652eb37196a5b72f356503a1fbb44fb98aa8a94954ad1765f86d81ebf41a2337d4eb58c4f19937fda3752f5d2d642756e44afdbd438015b87ac20801246bff
2 parents 9d5fcbf + db07f91 commit d32581c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/bench/bench.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ bool benchmark::State::KeepRunning()
9292

9393
--count;
9494

95+
assert(count != 0 && "count == 0 => (now == 0 && beginTime == 0) => return above");
96+
9597
// Output results
9698
double average = (now-beginTime)/count;
9799
int64_t averageCycles = (nowCycles-beginCycles)/count;

0 commit comments

Comments
 (0)