28 #ifndef VC_COMMON_UTILITY_H_
29 #define VC_COMMON_UTILITY_H_
33 namespace Vc_VERSIONED_NAMESPACE
41 template <
size_t x,
bool = (x & (x - 1)) == 0>
struct NextPowerOfTwo;
43 struct NextPowerOfTwo<x, true> :
public std::integral_constant<size_t, x> {
46 struct NextPowerOfTwo<x, false>
47 :
public std::integral_constant<
48 size_t, NextPowerOfTwo<(x | (x >> 1) | (x >> 2) | (x >> 5)) + 1>::value> {
57 struct BoundedAlignment :
public std::integral_constant<size_t,
58 #if defined Vc_MSVC || defined Vc_GCC
78 template <std::
size_t N>
static constexpr std::size_t left_size()
80 return Common::NextPowerOfTwo<(N + 1) / 2>::value;
86 template <std::
size_t N>
static constexpr std::size_t right_size()
88 return N - left_size<N>();
94 #endif // VC_COMMON_UTILITY_H_