File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
include/boost/decimal/detail Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1919namespace boost {
2020namespace decimal {
2121
22+ namespace detail {
23+
24+ template <typename T>
25+ constexpr auto make_me_constexpr_abs (T a) -> T { return ((a < T (0 )) ? -a : a); }
26+
27+ }
28+
2229// MSVC 14.1 warns of unary minus being applied to unsigned type from numeric_limits::min
2330// 14.2 and on get it right
2431#ifdef _MSC_VER
@@ -52,7 +59,7 @@ constexpr auto to_integral(Decimal val) noexcept
5259 auto result {static_cast <Conversion_Type>(val.full_significand ())};
5360 auto expval {val.biased_exponent ()};
5461
55- if (std::abs (expval) >= 19 )
62+ if (detail::make_me_constexpr_abs (expval) >= 19 )
5663 {
5764 result = 0 ;
5865 }
@@ -94,7 +101,7 @@ constexpr auto to_integral_128(Decimal val) noexcept
94101 auto sig {val.full_significand ()};
95102 auto expval {val.biased_exponent ()};
96103
97- if (std::abs (expval) >= 38 )
104+ if (detail::make_me_constexpr_abs (expval) >= 38 )
98105 {
99106 sig = 0 ;
100107 }
You can’t perform that action at this time.
0 commit comments