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); }