Arclight
Arclight copied to clipboard
Math functions are wrongly declared constexpr
All math functions should be constexpr since there is no reason for them to be non-compile-time-evaluatable. However, std defines them as non-constexpr due to potential side effects.
A solution would be to use intrinsics where applicable. On runtime, this seems to be the best solution. When an architecture does not support a certain operation or whenever an intrinsic is non-constexpr, we must resort to optimized algorithms.
To check if the function is currently compile-time evaluated, std::is_constant_evaluated
or (as soon as c++23 is supported) if consteval
may be used in such contexts.