Iros
 
Loading...
Searching...
No Matches
abs_unsigned.h
Go to the documentation of this file.
1#pragma once
2
5#include "di/meta/language.h"
6
7namespace di::math {
8namespace detail {
10 template<concepts::Integral T>
11 constexpr auto operator()(T value) const {
12 using R = meta::MakeUnsigned<T>;
13 if constexpr (concepts::SignedIntegral<T>) {
14 if (value == NumericLimits<T>::min) {
15 return R(value);
16 }
17 if (value < 0) {
18 return R(-value);
19 }
20 }
21 return R(value);
22 }
23 };
24}
25
26constexpr inline auto abs_unsigned = detail::AbsUnsignedFunction {};
27}
28
29namespace di {
31}
Definition language.h:247
Definition abs.h:11
Definition abs.h:10
constexpr auto abs_unsigned
Definition abs_unsigned.h:26
detail::MakeUnsignedHelper< RemoveCV< T > >::Type MakeUnsigned
Definition language.h:362
Definition zstring_parser.h:9
Definition numeric_limits.h:7
Definition abs_unsigned.h:9
constexpr auto operator()(T value) const
Definition abs_unsigned.h:11