1#ifndef TDLS_CORE_MATH_HPP
2#define TDLS_CORE_MATH_HPP
42#if defined(__has_builtin)
43#if __has_builtin(__builtin_is_constant_evaluated)
44 if (__builtin_is_constant_evaluated())
return x < T(0) ? -x : x;
46#elif defined(_MSC_VER) && _MSC_VER >= 1925
47 if (__builtin_is_constant_evaluated())
return x < T(0) ? -x : x;
Toolchain detection and portability macros.
#define TDLS_HOST_DEVICE
__host__ __device__ under CUDA, the equivalent attributes under HIP, empty elsewhere.
Definition macros.hpp:45
#define TDLS_FORCEINLINE
__forceinline__ under CUDA, the equivalent attribute under HIP (see TDLS_HOST_DEVICE for why),...
Definition macros.hpp:67
TDLS_HOST_DEVICE TDLS_FORCEINLINE constexpr T abs(const T x) noexcept
Absolute value usable in constant expressions.
Definition math.hpp:41