MapLibre Native Core
Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
v
Typedefs
a
c
d
e
f
g
i
l
m
n
o
p
s
t
u
v
Enumerations
a
b
c
e
f
h
i
k
l
m
n
o
r
s
t
v
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
Related Functions
a
b
e
i
m
o
s
t
Files
File List
File Members
All
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
log2.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cmath>
4
#include <cstdint>
5
#include <type_traits>
6
7
#if defined(__ANDROID__)
8
#include <android/api-level.h>
9
#endif
10
11
namespace
mbgl
{
12
namespace
util {
13
16
uint32_t
ceil_log2
(uint64_t x);
17
18
template
<
typename
T>
19
T
log2
(T x) {
20
// log2() is producing wrong results on ARMv5 binaries
21
// running on ARMv7+ CPUs.
22
#if defined(__ANDROID__)
23
return ::log(x) / M_LN2;
24
#else
25
return ::log2
(x);
26
#endif
27
}
28
29
}
// namespace util
30
}
// namespace mbgl
31
32
// log2 is not available on Android before API 18.
33
#if defined(__ANDROID__) && defined(__GNUC__) && \
34
defined(__ANDROID_API__) && __ANDROID_API__ < 18
35
36
template
<
typename
T>
37
typename
std::enable_if_t<std::is_floating_point_v<T>, T>
log2
(T x) {
38
return ::log(x) / M_LN2;
39
}
40
41
#endif
mbgl::util::log2
T log2(T x)
Definition:
log2.hpp:19
mbgl::util::ceil_log2
uint32_t ceil_log2(uint64_t x)
mbgl
Definition:
actor.hpp:15
include
mbgl
math
log2.hpp
MapLibre website
|
GitHub repository