From ef88520d6fc3a9a9461938cd2617305403e12362 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Wed, 6 Mar 2024 15:40:31 +0300 Subject: [PATCH] Revert "fix some warnings" (#1762) This reverts commit 1576991177ba97a4b2ff6c45950f1fa6e9aa678c. --- test/complexity_test.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/complexity_test.cc b/test/complexity_test.cc index fb4ad1ad..0c159cd2 100644 --- a/test/complexity_test.cc +++ b/test/complexity_test.cc @@ -71,7 +71,7 @@ void BM_Complexity_O1(benchmark::State &state) { for (auto _ : state) { // This test requires a non-zero CPU time to avoid divide-by-zero benchmark::DoNotOptimize(state.iterations()); - long tmp = state.iterations(); + double tmp = state.iterations(); benchmark::DoNotOptimize(tmp); for (benchmark::IterationCount i = 0; i < state.iterations(); ++i) { benchmark::DoNotOptimize(state.iterations()); @@ -120,7 +120,7 @@ void BM_Complexity_O_N(benchmark::State &state) { for (auto _ : state) { // This test requires a non-zero CPU time to avoid divide-by-zero benchmark::DoNotOptimize(state.iterations()); - long tmp = state.iterations(); + double tmp = state.iterations(); benchmark::DoNotOptimize(tmp); for (benchmark::IterationCount i = 0; i < state.iterations(); ++i) { benchmark::DoNotOptimize(state.iterations()); @@ -129,7 +129,7 @@ void BM_Complexity_O_N(benchmark::State &state) { } // 1ns per iteration per entry - state.SetIterationTime(static_cast(state.range(0)) * 42.0 * 1e-9); + state.SetIterationTime(state.range(0) * 42 * 1e-9); } state.SetComplexityN(state.range(0)); } @@ -178,7 +178,7 @@ static void BM_Complexity_O_N_log_N(benchmark::State &state) { for (auto _ : state) { // This test requires a non-zero CPU time to avoid divide-by-zero benchmark::DoNotOptimize(state.iterations()); - long tmp = state.iterations(); + double tmp = state.iterations(); benchmark::DoNotOptimize(tmp); for (benchmark::IterationCount i = 0; i < state.iterations(); ++i) { benchmark::DoNotOptimize(state.iterations()); @@ -186,8 +186,8 @@ static void BM_Complexity_O_N_log_N(benchmark::State &state) { benchmark::DoNotOptimize(tmp); } - state.SetIterationTime(static_cast(state.range(0)) * kLog2E * - std::log(state.range(0)) * 42.0 * 1e-9); + state.SetIterationTime(state.range(0) * kLog2E * std::log(state.range(0)) * + 42 * 1e-9); } state.SetComplexityN(state.range(0)); } @@ -238,7 +238,7 @@ void BM_ComplexityCaptureArgs(benchmark::State &state, int n) { for (auto _ : state) { // This test requires a non-zero CPU time to avoid divide-by-zero benchmark::DoNotOptimize(state.iterations()); - long tmp = state.iterations(); + double tmp = state.iterations(); benchmark::DoNotOptimize(tmp); for (benchmark::IterationCount i = 0; i < state.iterations(); ++i) { benchmark::DoNotOptimize(state.iterations()); @@ -246,7 +246,7 @@ void BM_ComplexityCaptureArgs(benchmark::State &state, int n) { benchmark::DoNotOptimize(tmp); } - state.SetIterationTime(static_cast(state.range(0)) * 42.0 * 1e-9); + state.SetIterationTime(state.range(0) * 42 * 1e-9); } state.SetComplexityN(n); }