diff --git a/README.md b/README.md index f34e8870..e30052dc 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ that might be used to customize high-order term calculation. ```c++ BENCHMARK(BM_StringCompare)->RangeMultiplier(2) - ->Range(1<<10, 1<<18)->Complexity([](size_t n)->double{return n; }); + ->Range(1<<10, 1<<18)->Complexity([](int n)->double{return n; }); ``` ### Templated benchmarks diff --git a/include/benchmark/benchmark_api.h b/include/benchmark/benchmark_api.h index 0cb43488..34cd0b5c 100644 --- a/include/benchmark/benchmark_api.h +++ b/include/benchmark/benchmark_api.h @@ -253,7 +253,7 @@ enum BigO { // BigOFunc is passed to a benchmark in order to specify the asymptotic // computational complexity for the benchmark. -typedef double(BigOFunc)(size_t); +typedef double(BigOFunc)(int); // State is passed to a running Benchmark and contains state for the // benchmark to use. diff --git a/src/complexity.cc b/src/complexity.cc index 0d53ade0..e25aa3c4 100644 --- a/src/complexity.cc +++ b/src/complexity.cc @@ -29,18 +29,18 @@ namespace benchmark { BigOFunc* FittingCurve(BigO complexity) { switch (complexity) { case oN: - return [](size_t n) -> double { return n; }; + return [](int n) -> double { return n; }; case oNSquared: - return [](size_t n) -> double { return n * n; }; + return [](int n) -> double { return n * n; }; case oNCubed: - return [](size_t n) -> double { return n * n * n; }; + return [](int n) -> double { return n * n * n; }; case oLogN: - return [](size_t n) { return log2(n); }; + return [](int n) { return log2(n); }; case oNLogN: - return [](size_t n) { return n * log2(n); }; + return [](int n) { return n * log2(n); }; case o1: default: - return [](size_t) { return 1.0; }; + return [](int) { return 1.0; }; } } diff --git a/test/complexity_test.cc b/test/complexity_test.cc index 03bd2dcc..662b627a 100644 --- a/test/complexity_test.cc +++ b/test/complexity_test.cc @@ -154,7 +154,7 @@ void BM_Complexity_O1(benchmark::State& state) { state.SetComplexityN(state.range_x()); } BENCHMARK(BM_Complexity_O1) -> Range(1, 1<<18) -> Complexity(benchmark::o1); -BENCHMARK(BM_Complexity_O1) -> Range(1, 1<<18) -> Complexity([](size_t){return 1.0; }); +BENCHMARK(BM_Complexity_O1) -> Range(1, 1<<18) -> Complexity([](int){return 1.0; }); BENCHMARK(BM_Complexity_O1) -> Range(1, 1<<18) -> Complexity(); std::string big_o_1_test_name = "BM_Complexity_O1_BigO"; @@ -192,7 +192,7 @@ void BM_Complexity_O_N(benchmark::State& state) { state.SetComplexityN(state.range_x()); } BENCHMARK(BM_Complexity_O_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(benchmark::oN); -BENCHMARK(BM_Complexity_O_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity([](size_t n) -> double{return n; }); +BENCHMARK(BM_Complexity_O_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity([](int n) -> double{return n; }); BENCHMARK(BM_Complexity_O_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(); std::string big_o_n_test_name = "BM_Complexity_O_N_BigO"; @@ -220,7 +220,7 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) { state.SetComplexityN(state.range_x()); } BENCHMARK(BM_Complexity_O_N_log_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(benchmark::oNLogN); -BENCHMARK(BM_Complexity_O_N_log_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity([](size_t n) {return n * log2(n); }); +BENCHMARK(BM_Complexity_O_N_log_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity([](int n) {return n * log2(n); }); BENCHMARK(BM_Complexity_O_N_log_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(); std::string big_o_n_lg_n_test_name = "BM_Complexity_O_N_log_N_BigO";