From 90ec4a403ae326b85dfa68afd5fd7ed47d5bc651 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Mon, 30 Jul 2012 09:44:54 +0200 Subject: [PATCH] Guard against 'divide by zero' in bench Also remove an useless cast. No functional change. Signed-off-by: Marco Costalba --- src/benchmark.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/benchmark.cpp b/src/benchmark.cpp index b0b9e16b..5800a37b 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -132,10 +132,10 @@ void benchmark(const Position& current, istream& is) { } } - int e = time.elapsed(); + int e = time.elapsed() + 1; // Assure positive to avoid a 'divide by zero' cerr << "\n===========================" << "\nTotal time (ms) : " << e << "\nNodes searched : " << nodes - << "\nNodes/second : " << int(nodes / (e / 1000.0)) << endl; + << "\nNodes/second : " << 1000 * nodes / e << endl; } -- 2.39.2