From db07f91899f2ed4dd52cafc5af103790c00f5462 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Fri, 13 Jan 2017 21:59:44 +0100 Subject: [PATCH] Assert that what might look like a possible division by zero is actually unreachable --- src/bench/bench.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp index 1bd9d06b8..24b2b56e9 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;