|
25 | 25 | #include <boost/decimal/detail/to_float.hpp> |
26 | 26 | #include <boost/decimal/detail/to_decimal.hpp> |
27 | 27 | #include <boost/decimal/detail/promotion.hpp> |
28 | | -#include <boost/decimal/detail/io.hpp> |
29 | 28 | #include <boost/decimal/detail/check_non_finite.hpp> |
30 | 29 | #include <boost/decimal/detail/shrink_significand.hpp> |
31 | 30 | #include <boost/decimal/detail/cmath/isfinite.hpp> |
@@ -458,18 +457,6 @@ class decimal32 final // NOLINT(cppcoreguidelines-special-member-functions,hicpp |
458 | 457 | friend constexpr auto operator<=>(Integer lhs, decimal32 rhs) noexcept -> std::enable_if_t<detail::is_integral_v<Integer>, std::partial_ordering>; |
459 | 458 | #endif |
460 | 459 |
|
461 | | - #if !defined(BOOST_DECIMAL_DISABLE_IOSTREAM) |
462 | | - // 3.2.10 Formatted input: |
463 | | - template <typename charT, typename traits, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType> |
464 | | - friend auto operator>>(std::basic_istream<charT, traits>& is, DecimalType& d) |
465 | | - -> std::enable_if_t<detail::is_decimal_floating_point_v<DecimalType>, std::basic_istream<charT, traits>&>; |
466 | | - |
467 | | - // 3.2.11 Formatted output: |
468 | | - template <typename charT, typename traits, BOOST_DECIMAL_DECIMAL_FLOATING_TYPE DecimalType> |
469 | | - friend auto operator<<(std::basic_ostream<charT, traits>& os, const DecimalType& d) |
470 | | - -> std::enable_if_t<detail::is_decimal_floating_point_v<DecimalType>, std::basic_ostream<charT, traits>&>; |
471 | | - #endif |
472 | | - |
473 | 460 | // Bitwise operators |
474 | 461 | friend constexpr auto operator&(decimal32 lhs, decimal32 rhs) noexcept -> decimal32; |
475 | 462 |
|
@@ -567,6 +554,11 @@ class decimal32 final // NOLINT(cppcoreguidelines-special-member-functions,hicpp |
567 | 554 | # pragma GCC diagnostic pop |
568 | 555 | #endif |
569 | 556 |
|
| 557 | +#if defined(__GNUC__) && __GNUC__ >= 6 |
| 558 | +# pragma GCC diagnostic push |
| 559 | +# pragma GCC diagnostic ignored "-Wduplicated-branches" |
| 560 | +#endif |
| 561 | + |
570 | 562 | template <typename T, typename T2, std::enable_if_t<detail::is_integral_v<T>, bool>> |
571 | 563 | constexpr decimal32::decimal32(T coeff, T2 exp, bool sign) noexcept // NOLINT(readability-function-cognitive-complexity,misc-no-recursion) |
572 | 564 | { |
@@ -608,7 +600,7 @@ constexpr decimal32::decimal32(T coeff, T2 exp, bool sign) noexcept // NOLINT(re |
608 | 600 | // Round as required |
609 | 601 | if (reduced) |
610 | 602 | { |
611 | | - exp += detail::fenv_round(unsigned_coeff, isneg); |
| 603 | + exp += static_cast<T2>(detail::fenv_round(unsigned_coeff, isneg)); |
612 | 604 | } |
613 | 605 |
|
614 | 606 | auto reduced_coeff {static_cast<std::uint32_t>(unsigned_coeff)}; |
@@ -730,6 +722,10 @@ constexpr decimal32::decimal32(T coeff, T2 exp, bool sign) noexcept // NOLINT(re |
730 | 722 | } |
731 | 723 | } |
732 | 724 |
|
| 725 | +#if defined(__GNUC__) && __GNUC__ >= 6 |
| 726 | +# pragma GCC diagnostic pop |
| 727 | +#endif |
| 728 | + |
733 | 729 | constexpr auto from_bits(std::uint32_t bits) noexcept -> decimal32 |
734 | 730 | { |
735 | 731 | decimal32 result; |
@@ -1540,6 +1536,14 @@ constexpr auto decimal32::edit_sign(bool sign) noexcept -> void |
1540 | 1536 | } |
1541 | 1537 | } |
1542 | 1538 |
|
| 1539 | +#if defined(__clang__) |
| 1540 | +# pragma clang diagnostic push |
| 1541 | +# pragma clang diagnostic ignored "-Wfloat-equal" |
| 1542 | +#elif defined(__GNUC__) |
| 1543 | +# pragma GCC diagnostic push |
| 1544 | +# pragma GCC diagnostic ignored "-Wfloat-equal" |
| 1545 | +#endif |
| 1546 | + |
1543 | 1547 | template <typename Float, std::enable_if_t<detail::is_floating_point_v<Float>, bool>> |
1544 | 1548 | BOOST_DECIMAL_CXX20_CONSTEXPR decimal32::decimal32(Float val) noexcept |
1545 | 1549 | { |
@@ -1572,6 +1576,12 @@ BOOST_DECIMAL_CXX20_CONSTEXPR decimal32::decimal32(Float val) noexcept |
1572 | 1576 | } |
1573 | 1577 | } |
1574 | 1578 |
|
| 1579 | +#if defined(__clang__) |
| 1580 | +# pragma clang diagnostic pop |
| 1581 | +#elif defined(__GNUC__) |
| 1582 | +# pragma GCC diagnostic pop |
| 1583 | +#endif |
| 1584 | + |
1575 | 1585 | template <typename Float, std::enable_if_t<detail::is_floating_point_v<Float>, bool>> |
1576 | 1586 | BOOST_DECIMAL_CXX20_CONSTEXPR auto decimal32::operator=(const Float& val) noexcept -> decimal32& |
1577 | 1587 | { |
@@ -1713,7 +1723,7 @@ constexpr auto mul_impl(T lhs_sig, std::int32_t lhs_exp, bool lhs_sign, |
1713 | 1723 |
|
1714 | 1724 | if (sig_dig > 9) |
1715 | 1725 | { |
1716 | | - res_sig /= detail::powers_of_10[sig_dig - 9]; |
| 1726 | + res_sig /= detail::pow10(static_cast<std::uint64_t>(sig_dig - 9)); |
1717 | 1727 | res_exp += sig_dig - 9; |
1718 | 1728 | } |
1719 | 1729 |
|
@@ -1825,7 +1835,7 @@ constexpr auto generic_div_impl(detail::decimal32_components lhs, detail::decima |
1825 | 1835 |
|
1826 | 1836 | if (sig_dig > std::numeric_limits<std::uint32_t>::digits10) |
1827 | 1837 | { |
1828 | | - res_sig /= detail::powers_of_10[sig_dig - std::numeric_limits<std::uint32_t>::digits10]; |
| 1838 | + res_sig /= detail::pow10(static_cast<std::uint64_t>(sig_dig - std::numeric_limits<std::uint32_t>::digits10)); |
1829 | 1839 | res_exp += sig_dig - std::numeric_limits<std::uint32_t>::digits10; |
1830 | 1840 | } |
1831 | 1841 |
|
|
0 commit comments