20 #ifndef ANTKEEPER_MATH_COMPILE_HPP
21 #define ANTKEEPER_MATH_COMPILE_HPP
37 template <std::
unsigned_
integral T>
40 return (x <= T(1)) ? T(0) :
ceil_log2((x + T(1)) / T(2)) + T(1);
50 template <std::
unsigned_
integral T>
51 [[nodiscard]] consteval T
exp2(T x) noexcept
53 return (x) ? T(2) << (x - 1) : T(1);
64 template <std::
unsigned_
integral T>
65 [[nodiscard]] consteval T
pow(T x, T e) noexcept
67 return (
e == 0) ? T(1) : (x * pow<T>(x,
e - 1));
consteval T ceil_log2(T x) noexcept
Compile-time ceil(log2(x)) for unsigned integrals.
consteval T pow(T x, T e) noexcept
Compile-time pow for unsigned integrals.
consteval T exp2(T x) noexcept
Compile-time exp2 for unsigned integrals.
Mathematical functions and data types.