fix issue 235 (#236)
diff --git a/src/complexity.cc b/src/complexity.cc
index 24f1cf4..93833f9 100644
--- a/src/complexity.cc
+++ b/src/complexity.cc
@@ -35,9 +35,9 @@
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 ee24202..8ab88f9 100644
--- a/test/complexity_test.cc
+++ b/test/complexity_test.cc
@@ -10,6 +10,7 @@
#include <vector>
#include <utility>
#include <algorithm>
+#include <cmath>
namespace {
@@ -220,7 +221,7 @@
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";