cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
is_power_of_two.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_BASIC_FUNCTIONS_IS_POWER_OF_TWO_H
4#define pRC_CORE_BASIC_FUNCTIONS_IS_POWER_OF_TWO_H
5
7
8namespace pRC
9{
10 template<class T, If<IsIntegral<T>> = 0>
11 static inline constexpr auto isPowerOfTwo(T const v)
12 {
13 return (v > 0) && !(v & (v - T(1)));
14 }
15}
16#endif // pRC_CORE_BASIC_FUNCTIONS_IS_POWER_OF_TWO_H
pRC::Float<> T
Definition externs_nonTT.hpp:1
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr auto isPowerOfTwo(T const v)
Definition is_power_of_two.hpp:11