| 63 | template <class T, |
| 64 | __CUTE_REQUIRES(is_arithmetic<T>::value)> |
| 65 | CUTE_HOST_DEVICE constexpr |
| 66 | auto |
| 67 | abs(T const& t) { |
| 68 | if constexpr (is_signed<T>::value) { |
| 69 | return t < T(0) ? -t : t; |
| 70 | } else { |
| 71 | return t; |
| 72 | } |
| 73 | |
| 74 | CUTE_GCC_UNREACHABLE; |
| 75 | } |
| 76 | |
| 77 | // Returns 1 if x > 0, -1 if x < 0, and 0 if x is zero. |
| 78 | template <class T, |
no test coverage detected