Thrill
0.1
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace 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
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Variables
a
b
c
d
f
g
i
k
l
m
n
p
r
s
t
v
w
x
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Enumerations
+
Enumerator
c
d
h
i
m
s
t
w
+
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
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
+
Variables
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
+
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerations
+
Enumerator
a
b
c
d
f
m
n
o
p
r
s
t
v
w
+
Related Functions
o
p
s
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
w
+
Functions
b
c
d
f
g
h
j
l
m
o
p
r
s
t
u
w
Variables
Typedefs
+
Macros
_
a
b
c
d
f
h
i
l
m
o
p
s
t
u
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
is_power_of_two.hpp
Go to the documentation of this file.
1
/*******************************************************************************
2
* tlx/math/is_power_of_two.hpp
3
*
4
* Part of tlx - http://panthema.net/tlx
5
*
6
* Copyright (C) 2007-2018 Timo Bingmann <tb@panthema.net>
7
*
8
* All rights reserved. Published under the Boost Software License, Version 1.0
9
******************************************************************************/
10
11
#ifndef TLX_MATH_IS_POWER_OF_TWO_HEADER
12
#define TLX_MATH_IS_POWER_OF_TWO_HEADER
13
14
namespace
tlx
{
15
16
//! \addtogroup tlx_math
17
//! \{
18
19
/******************************************************************************/
20
21
template
<
typename
Integral>
22
static
inline
bool
is_power_of_two_template
(Integral i) {
23
if
(i <= 0)
return
false
;
24
return
!(i & (i - 1));
25
}
26
27
/******************************************************************************/
28
// is_power_of_two()
29
30
//! does what it says: true if i is a power of two
31
static
inline
bool
is_power_of_two
(
int
i) {
32
return
is_power_of_two_template
(i);
33
}
34
35
//! does what it says: true if i is a power of two
36
static
inline
bool
is_power_of_two
(
unsigned
int
i) {
37
return
is_power_of_two_template
(i);
38
}
39
40
//! does what it says: true if i is a power of two
41
static
inline
bool
is_power_of_two
(
long
i) {
42
return
is_power_of_two_template
(i);
43
}
44
45
//! does what it says: true if i is a power of two
46
static
inline
bool
is_power_of_two
(
unsigned
long
i) {
47
return
is_power_of_two_template
(i);
48
}
49
50
//! does what it says: true if i is a power of two
51
static
inline
bool
is_power_of_two
(
long
long
i) {
52
return
is_power_of_two_template
(i);
53
}
54
55
//! does what it says: true if i is a power of two
56
static
inline
bool
is_power_of_two
(
unsigned
long
long
i) {
57
return
is_power_of_two_template
(i);
58
}
59
60
//! \}
61
62
}
// namespace tlx
63
64
#endif // !TLX_MATH_IS_POWER_OF_TWO_HEADER
65
66
/******************************************************************************/
tlx::is_power_of_two_template
static bool is_power_of_two_template(Integral i)
Definition:
is_power_of_two.hpp:22
tlx::is_power_of_two
static bool is_power_of_two(int i)
does what it says: true if i is a power of two
Definition:
is_power_of_two.hpp:31
tlx
Definition:
exclusive_scan.hpp:17
extlib
tlx
tlx
math
is_power_of_two.hpp
Generated on Mon Apr 6 2020 09:17:55 for Thrill by
1.8.13