summaryrefslogtreecommitdiff
path: root/include/mbgl/math
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-06-21 14:44:00 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-09-11 11:43:54 +0200
commit4a3c4edb59b6881a30056531bc71e52295ab1cb0 (patch)
treeb1c466667efc84cd5f7345d977032155f315ec76 /include/mbgl/math
parent30e570aae7d2ba5522feafb962b334ef3f35459e (diff)
downloadqtlocation-mapboxgl-4a3c4edb59b6881a30056531bc71e52295ab1cb0.tar.gz
[android] add support for gnustl
Diffstat (limited to 'include/mbgl/math')
-rw-r--r--include/mbgl/math/log2.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/mbgl/math/log2.hpp b/include/mbgl/math/log2.hpp
index 3136ac22b4..4f5fde60d1 100644
--- a/include/mbgl/math/log2.hpp
+++ b/include/mbgl/math/log2.hpp
@@ -15,6 +15,17 @@ namespace util {
// (== number of bits required to store x)
uint32_t ceil_log2(uint64_t x);
+template <typename T>
+T log2(T x) {
+// log2() is producing wrong results on ARMv5 binaries
+// running on ARMv7+ CPUs.
+#if defined(__ANDROID__)
+ return ::log(x) / M_LN2;
+#else
+ return ::log2(x);
+#endif
+}
+
} // namespace util
} // namespace mbgl