Commit 3fdd76bd by Ismael Committed by Dominic Hamon

fix issue 235 (#236)

parent 2d088a9f
...@@ -35,9 +35,9 @@ BigOFunc* FittingCurve(BigO complexity) { ...@@ -35,9 +35,9 @@ BigOFunc* FittingCurve(BigO complexity) {
case oNCubed: case oNCubed:
return [](int n) -> double { return n * n * n; }; return [](int n) -> double { return n * n * n; };
case oLogN: case oLogN:
return [](int n) { return log2(n); }; return [](int n) { return std::log2(n); };
case oNLogN: case oNLogN:
return [](int n) { return n * log2(n); }; return [](int n) { return n * std::log2(n); };
case o1: case o1:
default: default:
return [](int) { return 1.0; }; return [](int) { return 1.0; };
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <algorithm> #include <algorithm>
#include <cmath>
namespace { namespace {
...@@ -220,7 +221,7 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) { ...@@ -220,7 +221,7 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) {
state.SetComplexityN(state.range_x()); 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(benchmark::oNLogN);
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([](int n) {return n * std::log2(n); });
BENCHMARK(BM_Complexity_O_N_log_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity(); BENCHMARK(BM_Complexity_O_N_log_N) -> RangeMultiplier(2) -> Range(1<<10, 1<<16) -> Complexity();
const char* big_o_n_lg_n_test_name = "BM_Complexity_O_N_log_N_BigO"; const char* big_o_n_lg_n_test_name = "BM_Complexity_O_N_log_N_BigO";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment