diff options
author | lloyd <[email protected]> | 2008-11-23 01:29:24 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-23 01:29:24 +0000 |
commit | 8ec4a1fe7e8af6f8223908cdf8fe7de39170fc2a (patch) | |
tree | 9d6ce165282d6ab7ac848e922827415f2a6042b9 | |
parent | 9c8384163f42967045252d4491792a30b52bf066 (diff) |
Fix integer overflow in benchmars
-rw-r--r-- | src/benchmark/benchmark.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp index 0c6dcdfe9..4325af61e 100644 --- a/src/benchmark/benchmark.cpp +++ b/src/benchmark/benchmark.cpp @@ -35,7 +35,7 @@ std::pair<u32bit, u64bit> bench_buf_comp(BufferedComputation* buf_comp, nanoseconds_used = timer.clock() - start; } - return std::make_pair(reps * buf_len, nanoseconds_used); + return std::make_pair(reps, nanoseconds_used); } /** @@ -62,7 +62,7 @@ bench_block_cipher(BlockCipher* block_cipher, nanoseconds_used = timer.clock() - start; } - return std::make_pair(reps * buf_len, nanoseconds_used); + return std::make_pair(reps, nanoseconds_used); } /** @@ -85,7 +85,7 @@ bench_stream_cipher(StreamCipher* stream_cipher, nanoseconds_used = timer.clock() - start; } - return std::make_pair(reps * buf_len, nanoseconds_used); + return std::make_pair(reps, nanoseconds_used); } /** @@ -175,7 +175,7 @@ algorithm_benchmark(const std::string& name, /* 953.67 == 1000 * 1000 * 1000 / 1024 / 1024 - the conversion factor from bytes per nanosecond to mebibytes per second. */ - double speed = (953.67 * results.first) / results.second; + double speed = (953.67 * buf.size() * results.first) / results.second; all_results[provider] = speed; } } |