24#if ALPAKA_LANG_CUDA && ALPAKA_COMP_CLANG_CUDA || ALPAKA_COMP_HIP
33 template<std::
integral Integral>
36 return (a + b - Integral{1}) / b;
40 template<std::
integral Integral>
43 return std::max(a / b, Integral{1});
47 template<
typename Integral,
typename = std::enable_if_t<std::is_
integral_v<Integral>>>
53 for(Integral i = 1; i < n; i++)
59 template<
typename Integral,
typename = std::enable_if_t<std::is_
integral_v<Integral>>>
64 Integral R = value + 1;
67 Integral
const M = (L + R) / 2;
76 template<std::
integral T>
79 using UnsignedValueType = std::make_unsigned_t<T>;
80 return sizeof(T) * CHAR_BIT - 1 - std::countl_zero(
static_cast<UnsignedValueType
>(value));
87 template<std::
integral T>
102 template<
typename T,
template<
typename...>
typename U>
105 template<
template<
typename...>
typename U,
typename... Vs>
117 template<
typename T,
template<
typename...>
typename U>
124 constexpr auto ipow(std::integral
auto const base, std::integral
auto const exponent)
128 T_Res result = T_Res{1};
129 if(exponent == T_Res{0})
132 result =
ipow(base, exponent / T_Res{2});
135 if(exponent % T_Res{2})
#define ALPAKA_FN_HOST_ACC
All functions that can be used on an accelerator have to be attributed with ALPAKA_FN_ACC or ALPAKA_F...
#define ALPAKA_TYPEOF(...)
Get the type of instance.
Validates if T is a specialization of the unspecialized template type U.
ALPAKA_FN_HOST_ACC constexpr auto divExZero(Integral a, Integral b) -> Integral
Returns the max(a / b, 1) as integer.
constexpr T firstSetBit(T value)
ALPAKA_FN_HOST_ACC constexpr auto divCeil(Integral a, Integral b) -> Integral
Returns the ceiling of a / b, as integer.
ALPAKA_FN_HOST_ACC constexpr auto intPow(Integral base, Integral n) -> Integral
Computes the nth power of base, in integers.
constexpr T roundDownToPowerOfTwo(T value)
round to the next power of two which is equal or lower to the value
ALPAKA_FN_HOST_ACC constexpr auto nthRootFloor(Integral value, Integral n) -> Integral
Computes the floor of the nth root of value, in integers.
constexpr auto ipow(std::integral auto const base, std::integral auto const exponent)
Helper function calculating the integer power for the given base and exponent.
constexpr bool isSpecializationOf_v
checks if T is a instance of U