diff --git a/src/complexity.cc b/src/complexity.cc index 24f1cf4e..93833f96 100644 --- a/src/complexity.cc +++ b/src/complexity.cc @@ -35,9 +35,9 @@ BigOFunc* FittingCurve(BigO complexity) { case oNCubed: return [](int n) -> double { return n * n * n; }; case oLogN: - return [](int n) { return log2(n); }; + return [](int n) { return std::log2(n); }; case oNLogN: - return [](int n) { return n * log2(n); }; + return [](int n) { return n * std::log2(n); }; case o1: default: return [](int) { return 1.0; }; diff --git a/test/complexity_test.cc b/test/complexity_test.cc index ee242021..8ab88f97 100644 --- a/test/complexity_test.cc +++ b/test/complexity_test.cc @@ -10,6 +10,7 @@ #include #include #include +#include namespace { @@ -220,7 +221,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([](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(); const char* big_o_n_lg_n_test_name = "BM_Complexity_O_N_log_N_BigO";