Skip to content

Commit a3d1149

Browse files
committed
Add check for numeric_limits
1 parent 0baa172 commit a3d1149

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/boost/charconv/detail/to_chars_integer_impl.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,11 @@ BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars_128integer_impl(char* first, c
232232
}
233233

234234
// Strip the sign from the value and apply at the end after parsing if the type is signed
235-
#ifdef BOOST_CHARCONV_HAS_INT128
236-
BOOST_IF_CONSTEXPR (std::is_same<boost::int128_type, Integer>::value)
235+
BOOST_IF_CONSTEXPR (std::numeric_limits<Integer>::is_signed
236+
#ifdef BOOST_CHARCONV_HAS_INT128
237+
|| std::is_same<boost::int128_type, Integer>::value
238+
#endif
239+
)
237240
{
238241
if (value < 0)
239242
{
@@ -246,7 +249,6 @@ BOOST_CHARCONV_CONSTEXPR to_chars_result to_chars_128integer_impl(char* first, c
246249
}
247250
}
248251
else
249-
#endif
250252
{
251253
unsigned_value = static_cast<Unsigned_Integer>(value);
252254
}

0 commit comments

Comments
 (0)