aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-03-06 10:08:05 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-03-06 10:08:14 +0100
commitd32581cc29d195d063597ccdd6c29f2bf8c96fc3 (patch)
tree8cae20f9d1c3a899beb16219907e98d8ee785c72 /src
parent9d5fcbfb0889dd63495bd8e0b44bc0630ee9fa03 (diff)
parentdb07f91899f2ed4dd52cafc5af103790c00f5462 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/bench/bench.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp
index 3c9df4f713..b0df3d2b04 100644
--- a/src/bench/bench.cpp
+++ b/src/bench/bench.cpp
@@ -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;