Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
math.h
Go to the documentation of this file.
1
#ifndef STORM_UTILITY_MATH_H_
2
#define STORM_UTILITY_MATH_H_
3
4
#include <cmath>
5
6
#include "
storm/utility/OsDetection.h
"
7
#include "
storm/utility/macros.h
"
8
9
namespace
storm
{
10
namespace
utility {
11
namespace
math {
12
// We provide this method explicitly, because MSVC does not offer it (non-C99 compliant).
13
template
<
typename
ValueType>
14
static
inline
double
log2
(ValueType number) {
15
#ifndef WINDOWS
16
return
std::log2(number);
17
#else
18
return
std::log(number) / std::log(2);
19
#endif
20
}
21
22
inline
uint64_t
uint64_log2
(uint64_t n) {
23
STORM_LOG_ASSERT
(n != 0,
"N is 0."
);
24
#define S(k) \
25
if (n >= (UINT64_C(1) << k)) { \
26
i += k; \
27
n >>= k; \
28
}
29
uint64_t i = 0;
30
S
(32);
31
S
(16);
32
S
(8);
33
S
(4);
34
S
(2);
35
S
(1);
36
return
i;
37
#undef S
38
}
39
}
// namespace math
40
}
// namespace utility
41
}
// namespace storm
42
43
#endif
/* STORM_UTILITY_MATH_H_ */
OsDetection.h
macros.h
STORM_LOG_ASSERT
#define STORM_LOG_ASSERT(cond, message)
Definition
macros.h:11
S
#define S(k)
storm::utility::math::log2
static double log2(ValueType number)
Definition
math.h:14
storm::utility::math::uint64_log2
uint64_t uint64_log2(uint64_t n)
Definition
math.h:22
storm
LabParser.cpp.
Definition
cli.cpp:18
src
storm
utility
math.h
Generated by
1.9.8