SourceXtractorPlusPlus
0.15
Please provide a description of the project.
SEUtils
SEUtils
Misc.h
Go to the documentation of this file.
1
18
#ifndef _SEUTILS_MISC_H_
19
#define _SEUTILS_MISC_H_
20
21
#include <type_traits>
22
23
namespace
SourceXtractor
{
24
25
template
<
typename
T>
26
T
nextPowerOfTwo
(T v) {
27
static_assert(
std::is_unsigned<T>::value
,
"Type T must be unsigned"
);
28
v--;
29
for
(
size_t
i = 1; i <
sizeof
(v) * 8U; i *= 2) {
30
v |= v >> i;
31
}
32
v++;
33
return
v;
34
}
35
36
}
37
38
#endif
/* _SEUTILS_MISC_H_ */
std::is_unsigned
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::nextPowerOfTwo
T nextPowerOfTwo(T v)
Definition:
Misc.h:26
Generated by
1.9.1