SourceXtractorPlusPlus
0.14
Please provide a description of the project.
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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_ */
SourceXtractor::nextPowerOfTwo
T nextPowerOfTwo(T v)
Definition:
Misc.h:26
std::is_unsigned
Generated by
1.8.5