@@ -31,10 +31,11 @@ BOOST_DECIMAL_CONSTEXPR_VARIABLE auto d128_fast_snan = std::numeric_limits<uint1
3131
3232struct decimal128_fast_components
3333{
34- using sig_type = uint128;
34+ using significand_type = uint128;
35+ using biased_exponent_type = std::int_fast32_t ;
3536
36- uint128 sig;
37- std:: int32_t exp;
37+ significand_type sig;
38+ biased_exponent_type exp;
3839 bool sign;
3940};
4041
@@ -45,6 +46,7 @@ class decimal128_fast final
4546public:
4647 using significand_type = detail::uint128;
4748 using exponent_type = std::uint_fast32_t ;
49+ using biased_exponent_type = std::int_fast32_t ;
4850
4951private:
5052 // Instead of having to encode and decode at every operation
@@ -69,9 +71,9 @@ class decimal128_fast final
6971 return exponent_;
7072 }
7173
72- constexpr auto biased_exponent () const noexcept -> std::int32_t
74+ constexpr auto biased_exponent () const noexcept -> biased_exponent_type
7375 {
74- return static_cast <std:: int32_t >(exponent_) - detail::bias_v<decimal128>;
76+ return static_cast <biased_exponent_type >(exponent_) - detail::bias_v<decimal128>;
7577 }
7678
7779 template <typename Decimal, typename TargetType>
@@ -820,7 +822,7 @@ constexpr auto operator+(decimal128_fast lhs, Integer rhs) noexcept
820822 auto lhs_components {detail::decimal128_fast_components{lhs.significand_ , lhs.biased_exponent (), lhs.isneg ()}};
821823
822824 auto sig_rhs {static_cast <detail::uint128>(detail::make_positive_unsigned (rhs))};
823- std:: int32_t exp_rhs {0 };
825+ decimal128_fast::biased_exponent_type exp_rhs {0 };
824826 detail::normalize<decimal128>(sig_rhs, exp_rhs);
825827 auto unsigned_sig_rhs = detail::make_positive_unsigned (sig_rhs);
826828 auto rhs_components {detail::decimal128_fast_components{unsigned_sig_rhs, exp_rhs, (rhs < 0 )}};
@@ -914,7 +916,7 @@ constexpr auto operator-(decimal128_fast lhs, Integer rhs) noexcept
914916 auto lhs_components {detail::decimal128_fast_components{lhs.significand_ , lhs.biased_exponent (), lhs.isneg ()}};
915917
916918 auto sig_rhs {static_cast <detail::uint128>(detail::make_positive_unsigned (rhs))};
917- std:: int32_t exp_rhs {0 };
919+ decimal128_fast::biased_exponent_type exp_rhs {0 };
918920 detail::normalize<decimal128>(sig_rhs, exp_rhs);
919921 auto unsigned_sig_rhs {detail::make_positive_unsigned (sig_rhs)};
920922 auto rhs_components {detail::decimal128_fast_components{unsigned_sig_rhs, exp_rhs, (rhs < 0 )}};
@@ -946,7 +948,7 @@ constexpr auto operator-(Integer lhs, decimal128_fast rhs) noexcept
946948 const bool abs_lhs_bigger {detail::make_positive_unsigned (lhs) > abs (rhs)};
947949
948950 auto sig_lhs {static_cast <detail::uint128>(detail::make_positive_unsigned (lhs))};
949- std:: int32_t exp_lhs {0 };
951+ decimal128_fast::biased_exponent_type exp_lhs {0 };
950952 detail::normalize<decimal128>(sig_lhs, exp_lhs);
951953 auto unsigned_sig_lhs {detail::make_positive_unsigned (sig_lhs)};
952954 auto lhs_components {detail::decimal128_fast_components{unsigned_sig_lhs, exp_lhs, (lhs < 0 )}};
@@ -992,7 +994,7 @@ constexpr auto operator*(decimal128_fast lhs, Integer rhs) noexcept
992994 #endif
993995
994996 auto rhs_sig {static_cast <detail::uint128>(detail::make_positive_unsigned (rhs))};
995- std:: int32_t rhs_exp {0 };
997+ decimal128_fast::biased_exponent_type rhs_exp {0 };
996998 detail::normalize<decimal128_fast>(rhs_sig, rhs_exp);
997999
9981000 const auto result {detail::d128_fast_mul_impl<detail::decimal128_fast_components>(
@@ -1128,7 +1130,7 @@ constexpr auto operator/(decimal128_fast lhs, Integer rhs) noexcept
11281130 detail::decimal128_fast_components lhs_components {lhs.significand_ , lhs.biased_exponent (), lhs.isneg ()};
11291131
11301132 auto rhs_sig {detail::make_positive_unsigned (rhs)};
1131- std:: int32_t rhs_exp {};
1133+ decimal128_fast::biased_exponent_type rhs_exp {};
11321134 detail::decimal128_fast_components rhs_components {rhs_sig, rhs_exp, rhs < 0 };
11331135 detail::decimal128_fast_components q_components {};
11341136
0 commit comments