summaryrefslogtreecommitdiff
path: root/src/mbgl/util/math.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/util/math.cpp')
-rw-r--r--src/mbgl/util/math.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mbgl/util/math.cpp b/src/mbgl/util/math.cpp
index a524754109..0e86849ad3 100644
--- a/src/mbgl/util/math.cpp
+++ b/src/mbgl/util/math.cpp
@@ -21,5 +21,15 @@ uint32_t ceil_log2(uint64_t x) {
return y;
}
+double log2(double x) {
+// log2() is producing wrong results on ARMv5 binaries
+// running on ARMv7+ CPUs.
+#if defined(__ANDROID__) && defined(__ARM_ARCH_5TE__)
+ return std::log(x) / 0.6931471805599453; // log(x) / log(2)
+#else
+ return ::log2(x);
+#endif
+}
+
} // namespace util
-} // namespace mbgl \ No newline at end of file
+} // namespace mbgl