mathematical functions (mostly very-simple ones) implemented using compile-time-executable code.
More...
|
template<typename T , typename Lower = T, typename Upper = T> |
constexpr KAT_FHD bool | kat::between_or_equal (T x, Lower l, Upper u) noexcept |
|
template<typename T , typename Lower = T, typename Upper = T> |
constexpr KAT_FHD bool | kat::strictly_between (T x, Lower l, Upper u) noexcept |
|
template<typename T > |
constexpr KAT_FHD bool | kat::is_power_of_2 (T val) noexcept |
|
template<typename T > |
constexpr KAT_FHD T | kat::detail::ipow (T base, unsigned exponent, T coefficient) noexcept |
|
template<typename I > |
constexpr KAT_FHD I | kat::ipow (I base, unsigned exponent) noexcept |
|
template<typename I , typename I2 > |
constexpr KAT_FHD I | kat::div_rounding_up (I dividend, const I2 divisor) noexcept |
|
template<typename I , typename I2 > |
constexpr KAT_FHD I | kat::round_down (const I dividend, const I2 divisor) noexcept |
|
template<typename I , typename I2 = I> |
constexpr KAT_FHD I | kat::round_down_to_power_of_2 (I x, I2 power_of_2) noexcept |
|
template<typename I > |
constexpr KAT_FHD I | kat::round_down_to_full_warps (I x) noexcept |
|
template<typename I , typename I2 = I> |
constexpr KAT_FHD I | kat::round_up (I x, I2 y) noexcept |
|
template<typename I , typename I2 = I> |
constexpr KAT_FHD I | kat::round_up_to_power_of_2 (I x, I2 power_of_2) noexcept |
|
template<typename I > |
constexpr KAT_FHD I | kat::round_up_to_full_warps (I x) noexcept |
|
template<typename S , typename T = S> |
constexpr KAT_FHD std::common_type< S, T >::type | kat::gcd (S u, T v) noexcept |
|
template<typename S , typename T = S> |
constexpr KAT_FHD std::common_type< S, T >::type | kat::lcm (S u, T v) noexcept |
|
template<typename I > |
constexpr KAT_FHD bool | kat::divides (I non_zero_divisor, I dividend) noexcept |
|
template<typename I > |
constexpr KAT_FHD bool | kat::is_divisible_by (I dividend, I non_zero_divisor) noexcept |
|
template<typename I > |
constexpr KAT_FHD I | kat::modulo_power_of_2 (I x, I power_of_2_modulus) noexcept |
|
template<typename I > |
constexpr KAT_FHD bool | kat::power_of_2_divides (I power_of_2_divisor, I dividend) noexcept |
|
template<typename I > |
constexpr KAT_FHD bool | kat::is_divisible_by_power_of_2 (I dividend, I power_of_2_divisor) noexcept |
|
template<typename I > |
constexpr KAT_FHD bool | kat::is_even (I x) noexcept |
|
template<typename I > |
constexpr KAT_FHD bool | kat::is_odd (I x) noexcept |
|
template<typename I > |
constexpr KAT_FHD I | kat::detail::increment_modular_remainder (I modular_remainder, I modulus) noexcept |
|
template<typename I > |
constexpr KAT_FHD I | kat::detail::decrement_modular_remainder (I modular_remainder, I modulus) noexcept |
|
template<typename I > |
constexpr KAT_FHD I | kat::modular_increment (I x, I modulus) |
|
template<typename I > |
constexpr KAT_FHD I | kat::modular_decrement (I x, I modulus) |
|
template<typename I , typename I2 = I> |
constexpr KAT_FHD I | kat::unsafe::round_up_to_power_of_2 (I x, I2 power_of_2) noexcept |
|
template<typename I > |
constexpr KAT_FHD I | kat::unsafe::round_up_to_full_warps (I x) noexcept |
|
template<typename I1 , typename I2 > |
constexpr KAT_FHD I1 | kat::unsafe::div_rounding_up (I1 x, const I2 modulus) noexcept |
|
template<typename I1 , typename I2 = I1> |
constexpr KAT_FHD I1 | kat::unsafe::round_up (I1 x, I2 y) noexcept |
|
template<typename I > |
constexpr I | kat::unsafe::modular_increment (I x, I modulus) |
|
template<typename I > |
constexpr I | kat::unsafe::modular_decrement (I x, I modulus) |
|
template<typename I > |
constexpr KAT_FHD int | kat::constexpr_::log2 (I val) noexcept |
|
template<typename T > |
constexpr KAT_FHD T | kat::constexpr_::detail::sqrt_helper (T x, T low, T high) noexcept |
|
template<typename T > |
constexpr KAT_FHD T | kat::constexpr_::sqrt (T x) noexcept |
|
mathematical functions (mostly very-simple ones) implemented using compile-time-executable code.
- Note
- Some of these mathematical functions are also the reasonable runtime- executable version, some are less efficient, to avoid non-constexpr constructs. The former appear outside of any namespace, the latter have their own namespace (
constexpr_
) to make them their use be more explicit. This will only be able to change when CUDA supports C++20, which will have a std::is_constant_evaluated
type trait.