Skip to content

Commit 3048edd

Browse files
committed
Change function signature to take the enum class
1 parent c048f1a commit 3048edd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/boost/decimal/decimal32_t.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <boost/decimal/detail/to_chars_result.hpp>
4242
#include <boost/decimal/detail/chars_format.hpp>
4343
#include <boost/decimal/detail/from_string.hpp>
44+
#include <boost/decimal/detail/construction_sign.hpp>
4445

4546
#ifndef BOOST_DECIMAL_BUILD_MODULE
4647

@@ -297,7 +298,7 @@ BOOST_DECIMAL_EXPORT class decimal32_t final // NOLINT(cppcoreguidelines-special
297298
#else
298299
template <typename T1, typename T2, std::enable_if_t<detail::is_unsigned_v<T1> && detail::is_integral_v<T2>, bool> = true>
299300
#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;
301302

302303
#ifdef BOOST_DECIMAL_HAS_CONCEPTS
303304
template <BOOST_DECIMAL_SIGNED_INTEGRAL T1, BOOST_DECIMAL_INTEGRAL T2>
@@ -651,11 +652,12 @@ template <BOOST_DECIMAL_UNSIGNED_INTEGRAL T1, BOOST_DECIMAL_INTEGRAL T2>
651652
#else
652653
template <typename T1, typename T2, std::enable_if_t<detail::is_unsigned_v<T1> && detail::is_integral_v<T2>, bool>>
653654
#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)
655656
{
656657
static_assert(detail::is_integral_v<T1>, "Coefficient must be an integer");
657658
static_assert(detail::is_integral_v<T2>, "Exponent must be an integer");
658659

660+
const auto is_negative {static_cast<bool>(resultant_sign)};
659661
bits_ = is_negative ? detail::d32_sign_mask : UINT32_C(0);
660662

661663
// If the coeff is not in range, make it so

0 commit comments

Comments
 (0)