mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 03:07:36 +02:00
Fix handling of 128-bit ints
This commit is contained in:
@ -815,6 +815,10 @@ class FMT_API format_error : public std::runtime_error {
|
|||||||
FMT_MODULE_EXPORT_END
|
FMT_MODULE_EXPORT_END
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
template <typename T> struct is_integral : std::is_integral<T> {};
|
||||||
|
template <> struct is_integral<int128_t> : std::true_type {};
|
||||||
|
template <> struct is_integral<uint128_t> : std::true_type {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using is_signed =
|
using is_signed =
|
||||||
std::integral_constant<bool, std::numeric_limits<T>::is_signed ||
|
std::integral_constant<bool, std::numeric_limits<T>::is_signed ||
|
||||||
@ -1607,8 +1611,7 @@ FMT_CONSTEXPR inline void prefix_append(unsigned& prefix, unsigned value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char, typename OutputIt, typename T,
|
template <typename Char, typename OutputIt, typename T,
|
||||||
FMT_ENABLE_IF(std::is_integral<T>::value &&
|
FMT_ENABLE_IF(is_integral<T>::value && !std::is_same<T, bool>::value)>
|
||||||
!std::is_same<T, bool>::value)>
|
|
||||||
FMT_CONSTEXPR FMT_INLINE OutputIt
|
FMT_CONSTEXPR FMT_INLINE OutputIt
|
||||||
write_int(OutputIt out, T value, const basic_format_specs<Char>& specs,
|
write_int(OutputIt out, T value, const basic_format_specs<Char>& specs,
|
||||||
locale_ref loc) {
|
locale_ref loc) {
|
||||||
@ -1674,7 +1677,7 @@ write_int(OutputIt out, T value, const basic_format_specs<Char>& specs,
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
template <typename Char, typename OutputIt, typename T,
|
template <typename Char, typename OutputIt, typename T,
|
||||||
FMT_ENABLE_IF(std::is_integral<T>::value &&
|
FMT_ENABLE_IF(is_integral<T>::value &&
|
||||||
!std::is_same<T, bool>::value &&
|
!std::is_same<T, bool>::value &&
|
||||||
std::is_same<OutputIt, buffer_appender<Char>>::value)>
|
std::is_same<OutputIt, buffer_appender<Char>>::value)>
|
||||||
FMT_CONSTEXPR OutputIt write(OutputIt out, T value,
|
FMT_CONSTEXPR OutputIt write(OutputIt out, T value,
|
||||||
@ -1682,9 +1685,9 @@ FMT_CONSTEXPR OutputIt write(OutputIt out, T value,
|
|||||||
locale_ref loc) {
|
locale_ref loc) {
|
||||||
return write_int(out, value, specs, loc);
|
return write_int(out, value, specs, loc);
|
||||||
}
|
}
|
||||||
// An inlined version of format_int used in format string compilation.
|
// An inlined version of write used in format string compilation.
|
||||||
template <typename Char, typename OutputIt, typename T,
|
template <typename Char, typename OutputIt, typename T,
|
||||||
FMT_ENABLE_IF(std::is_integral<T>::value &&
|
FMT_ENABLE_IF(is_integral<T>::value &&
|
||||||
!std::is_same<T, bool>::value &&
|
!std::is_same<T, bool>::value &&
|
||||||
!std::is_same<OutputIt, buffer_appender<Char>>::value)>
|
!std::is_same<OutputIt, buffer_appender<Char>>::value)>
|
||||||
FMT_CONSTEXPR FMT_INLINE OutputIt write(OutputIt out, T value,
|
FMT_CONSTEXPR FMT_INLINE OutputIt write(OutputIt out, T value,
|
||||||
@ -1991,10 +1994,6 @@ OutputIt write_ptr(OutputIt out, UIntPtr value,
|
|||||||
: base_iterator(out, write(reserve(out, size)));
|
: base_iterator(out, write(reserve(out, size)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> struct is_integral : std::is_integral<T> {};
|
|
||||||
template <> struct is_integral<int128_t> : std::true_type {};
|
|
||||||
template <> struct is_integral<uint128_t> : std::true_type {};
|
|
||||||
|
|
||||||
template <typename Char, typename OutputIt>
|
template <typename Char, typename OutputIt>
|
||||||
OutputIt write(OutputIt out, monostate) {
|
OutputIt write(OutputIt out, monostate) {
|
||||||
FMT_ASSERT(false, "");
|
FMT_ASSERT(false, "");
|
||||||
|
Reference in New Issue
Block a user