Skip to content

Commit 728f7c4

Browse files
authored
Merge pull request #279 from boostorg/develop
Fix for Debian Build Issue
2 parents 508c4da + 3554bc1 commit 728f7c4

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

include/boost/charconv/detail/config.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,18 @@ static_assert((BOOST_CHARCONV_ENDIAN_BIG_BYTE || BOOST_CHARCONV_ENDIAN_LITTLE_BY
188188
# define BOOST_CHARCONV_HAS_BRAINFLOAT16
189189
#endif
190190

191+
// Check for PPC64LE with IEEE long double (which is an alias to __float128)
192+
// See: https://github.com/boostorg/boost/issues/1035
193+
//
194+
// IBM128 has 106 Mantissa Digits whereas IEEE128 has 113
195+
// https://developers.redhat.com/articles/2023/05/16/benefits-fedora-38-long-double-transition-ppc64le#
196+
#if (defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)) && (defined(__LONG_DOUBLE_IEEE128__) || LDBL_MANT_DIG == 113)
197+
198+
#define BOOST_CHARCONV_LDBL_IS_FLOAT128
199+
#define BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE
200+
static_assert(std::is_same<long double, __float128>::value, "__float128 should be an alias to long double. Please open an issue at: https://github.com/boostorg/charconv");
201+
202+
#endif
203+
204+
191205
#endif // BOOST_CHARCONV_DETAIL_CONFIG_HPP

src/from_chars.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ boost::charconv::from_chars_result boost::charconv::from_chars_erange(const char
229229
return r;
230230
}
231231

232-
#elif !defined(BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE)
232+
#elif !defined(BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE) && !defined(BOOST_CHARCONV_LDBL_IS_FLOAT128)
233233

234234
boost::charconv::from_chars_result boost::charconv::from_chars_erange(const char* first, const char* last, long double& value, boost::charconv::chars_format fmt) noexcept
235235
{

src/to_chars.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ boost::charconv::to_chars_result boost::charconv::to_chars(char* first, char* la
602602
return boost::charconv::detail::to_chars_float_impl(first, last, static_cast<double>(value), fmt, precision);
603603
}
604604

605-
#elif !defined(BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE)
605+
#elif !defined(BOOST_CHARCONV_UNSUPPORTED_LONG_DOUBLE) && !defined(BOOST_CHARCONV_LDBL_IS_FLOAT128)
606606

607607
boost::charconv::to_chars_result boost::charconv::to_chars(char* first, char* last, long double value,
608608
boost::charconv::chars_format fmt) noexcept

src/to_chars_float_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ to_chars_result to_chars_float_impl(char* first, char* last, Real value, chars_f
770770
return boost::charconv::detail::to_chars_hex(first, last, value, precision);
771771
}
772772

773-
#if (BOOST_CHARCONV_LDBL_BITS == 80 || BOOST_CHARCONV_LDBL_BITS == 128)
773+
#if (BOOST_CHARCONV_LDBL_BITS == 80 || BOOST_CHARCONV_LDBL_BITS == 128) && !defined(BOOST_CHARCONV_LDBL_IS_FLOAT128)
774774

775775
template <>
776776
to_chars_result to_chars_float_impl(char* first, char* last, long double value, chars_format fmt, int precision) noexcept

0 commit comments

Comments
 (0)