|
41 | 41 | #include <boost/decimal/detail/to_chars_result.hpp> |
42 | 42 | #include <boost/decimal/detail/chars_format.hpp> |
43 | 43 | #include <boost/decimal/detail/from_string.hpp> |
| 44 | +#include <boost/decimal/detail/construction_sign.hpp> |
44 | 45 |
|
45 | 46 | #ifndef BOOST_DECIMAL_BUILD_MODULE |
46 | 47 |
|
@@ -297,7 +298,7 @@ BOOST_DECIMAL_EXPORT class decimal32_t final // NOLINT(cppcoreguidelines-special |
297 | 298 | #else |
298 | 299 | template <typename T1, typename T2, std::enable_if_t<detail::is_unsigned_v<T1> && detail::is_integral_v<T2>, bool> = true> |
299 | 300 | #endif |
300 | | - constexpr decimal32_t(T1 coeff, T2 exp, bool is_negative = false) noexcept; |
| 301 | + constexpr decimal32_t(T1 coeff, T2 exp, detail::construction_sign_wrapper resultant_sign = construction_sign::positive) noexcept; |
301 | 302 |
|
302 | 303 | #ifdef BOOST_DECIMAL_HAS_CONCEPTS |
303 | 304 | template <BOOST_DECIMAL_SIGNED_INTEGRAL T1, BOOST_DECIMAL_INTEGRAL T2> |
@@ -651,11 +652,12 @@ template <BOOST_DECIMAL_UNSIGNED_INTEGRAL T1, BOOST_DECIMAL_INTEGRAL T2> |
651 | 652 | #else |
652 | 653 | template <typename T1, typename T2, std::enable_if_t<detail::is_unsigned_v<T1> && detail::is_integral_v<T2>, bool>> |
653 | 654 | #endif |
654 | | -constexpr decimal32_t::decimal32_t(T1 coeff, T2 exp, bool is_negative) noexcept // NOLINT(readability-function-cognitive-complexity,misc-no-recursion) |
| 655 | +constexpr decimal32_t::decimal32_t(T1 coeff, T2 exp, const detail::construction_sign_wrapper resultant_sign) noexcept // NOLINT(readability-function-cognitive-complexity,misc-no-recursion) |
655 | 656 | { |
656 | 657 | static_assert(detail::is_integral_v<T1>, "Coefficient must be an integer"); |
657 | 658 | static_assert(detail::is_integral_v<T2>, "Exponent must be an integer"); |
658 | 659 |
|
| 660 | + const auto is_negative {static_cast<bool>(resultant_sign)}; |
659 | 661 | bits_ = is_negative ? detail::d32_sign_mask : UINT32_C(0); |
660 | 662 |
|
661 | 663 | // If the coeff is not in range, make it so |
|
0 commit comments