Skip to content

Commit 8ddbb0e

Browse files
committed
Fix i128 limits impl
1 parent 41b611e commit 8ddbb0e

File tree

1 file changed

+45
-8
lines changed

1 file changed

+45
-8
lines changed

include/boost/int128/detail/int128_imp.hpp

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,17 +3245,14 @@ inline int128_t& int128_t::operator%=(const Integer rhs) noexcept
32453245

32463246
#endif // BOOST_INT128_HAS_MSVC_INT128
32473247

3248-
} // namespace int128
3249-
} // namespace boost
3250-
3251-
namespace std {
3248+
namespace detail {
32523249

3253-
template <>
3254-
class numeric_limits<boost::int128::int128_t>
3250+
template <bool>
3251+
class numeric_limits_impl_i128
32553252
{
32563253
public:
32573254

3258-
// Member constants
3255+
// Member constants
32593256
static constexpr bool is_specialized = true;
32603257
static constexpr bool is_signed = true;
32613258
static constexpr bool is_integer = true;
@@ -3309,6 +3306,46 @@ class numeric_limits<boost::int128::int128_t>
33093306
static constexpr auto denorm_min () -> boost::int128::int128_t { return {0, 0}; }
33103307
};
33113308

3312-
} // namespace std
3309+
#if !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L
3310+
3311+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::is_specialized;
3312+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::is_signed;
3313+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::is_integer;
3314+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::is_exact;
3315+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::has_infinity;
3316+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::has_quiet_NaN;
3317+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::has_signaling_NaN;
3318+
3319+
// These members were deprecated in C++23
3320+
#if ((!defined(_MSC_VER) && (__cplusplus <= 202002L)) || (defined(_MSC_VER) && (_MSVC_LANG <= 202002L)))
3321+
template <bool b> constexpr std::float_denorm_style numeric_limits_impl_i128<b>::has_denorm;
3322+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::has_denorm_loss;
3323+
#endif
3324+
3325+
template <bool b> constexpr std::float_round_style numeric_limits_impl_i128<b>::round_style;
3326+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::is_iec559;
3327+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::is_bounded;
3328+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::is_modulo;
3329+
template <bool b> constexpr int numeric_limits_impl_i128<b>::digits;
3330+
template <bool b> constexpr int numeric_limits_impl_i128<b>::digits10;
3331+
template <bool b> constexpr int numeric_limits_impl_i128<b>::max_digits10;
3332+
template <bool b> constexpr int numeric_limits_impl_i128<b>::radix;
3333+
template <bool b> constexpr int numeric_limits_impl_i128<b>::min_exponent;
3334+
template <bool b> constexpr int numeric_limits_impl_i128<b>::min_exponent10;
3335+
template <bool b> constexpr int numeric_limits_impl_i128<b>::max_exponent;
3336+
template <bool b> constexpr int numeric_limits_impl_i128<b>::max_exponent10;
3337+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::traps;
3338+
template <bool b> constexpr bool numeric_limits_impl_i128<b>::tinyness_before;
3339+
3340+
#endif // !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L
3341+
3342+
} // namespace detail
3343+
3344+
} // namespace int128
3345+
} // namespace boost
3346+
3347+
template <>
3348+
class std::numeric_limits<boost::int128::int128_t> :
3349+
public boost::int128::detail::numeric_limits_impl_i128<true> {};
33133350

33143351
#endif // BOOST_INT128_DETAIL_INT128_HPP

0 commit comments

Comments
 (0)