aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-11-17 02:25:53 +0000
committerlloyd <[email protected]>2007-11-17 02:25:53 +0000
commitfedea15eb92bed68148a57fbd3b0b5ab3d2cb4b8 (patch)
tree64cc0642d49a7932dc5c4540773c7bca7dedf716
parent48683e5f3cc108bc7ee5cc9492aefd18d2fc7699 (diff)
Replace C-style casts with static_cast (found by GCC's -Wold-style-cast)
-rw-r--r--checks/bench.cpp8
-rw-r--r--checks/pk_bench.cpp3
2 files changed, 5 insertions, 6 deletions
diff --git a/checks/bench.cpp b/checks/bench.cpp
index b8d1cbd23..089b229f2 100644
--- a/checks/bench.cpp
+++ b/checks/bench.cpp
@@ -35,7 +35,7 @@ double bench_filter(std::string name, Botan::Filter* filter,
u32bit iterations = 0;
u64bit start = get_clock(), clocks_used = 0;
- u64bit go_up_to = (u64bit)(seconds * get_ticks());
+ u64bit go_up_to = static_cast<u64bit>(seconds * get_ticks());
while(clocks_used < go_up_to)
{
@@ -44,8 +44,8 @@ double bench_filter(std::string name, Botan::Filter* filter,
clocks_used = get_clock() - start;
}
- double bytes_per_sec = ((double)iterations * BUFFERSIZE) /
- ((double)clocks_used / get_ticks());
+ double bytes_per_sec = (static_cast<double>(iterations) * BUFFERSIZE) /
+ (static_cast<double>(clocks_used) / get_ticks());
double mbytes_per_sec = bytes_per_sec / (1024.0 * 1024.0);
std::cout.setf(std::ios::fixed, std::ios::floatfield);
@@ -121,7 +121,7 @@ void benchmark(const std::string& what, bool html, double seconds)
if(html)
std::cout << "</TABLE>\n\n";
- double average = std::exp(sum / (double)how_many);
+ double average = std::exp(sum / static_cast<double>(how_many));
if(what == "All" && html)
std::cout << "\n<P>Overall speed average: " << average
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp
index f829c05e8..7b0150c24 100644
--- a/checks/pk_bench.cpp
+++ b/checks/pk_bench.cpp
@@ -178,11 +178,10 @@ void bench_pk(const std::string& algo, bool html, double seconds)
void print_result(bool html, u32bit runs, u64bit clocks_used,
const std::string& algo_name, const std::string& op)
{
- double seconds = (double)clocks_used / get_ticks();
+ double seconds = static_cast<double>(clocks_used) / get_ticks();
double mseconds_per_run = 1000 * (seconds / runs);
double runs_per_sec = runs / seconds;
-
if(html)
{
std::cout << " <TR><TH>" << algo_name << " (" << op << ") <TH>";