42#include <system_error>
44#ifdef __cpp_lib_bit_cast
51# define FMT_GCC_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
53# define FMT_GCC_VISIBILITY_HIDDEN
57# define FMT_CUDA_VERSION (__CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__)
59# define FMT_CUDA_VERSION 0
63# define FMT_HAS_BUILTIN(x) __has_builtin(x)
65# define FMT_HAS_BUILTIN(x) 0
68#if FMT_GCC_VERSION || FMT_CLANG_VERSION
69# define FMT_NOINLINE __attribute__((noinline))
75# define FMT_MSC_DEFAULT = default
77# define FMT_MSC_DEFAULT
82# if FMT_MSC_VERSION || defined(__NVCC__)
85template <
typename Exception>
inline void do_throw(
const Exception& x) {
88 volatile bool b =
true;
93# define FMT_THROW(x) detail::do_throw(x)
95# define FMT_THROW(x) throw x
98# define FMT_THROW(x) \
100 FMT_ASSERT(false, (x).what()); \
107# define FMT_CATCH(x) catch (x)
109# define FMT_TRY if (true)
110# define FMT_CATCH(x) if (false)
113#ifndef FMT_MAYBE_UNUSED
114# if FMT_HAS_CPP17_ATTRIBUTE(maybe_unused)
115# define FMT_MAYBE_UNUSED [[maybe_unused]]
117# define FMT_MAYBE_UNUSED
121#ifndef FMT_USE_USER_DEFINED_LITERALS
123# if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 407 || \
124 FMT_MSC_VERSION >= 1900) && \
125 (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 480)
126# define FMT_USE_USER_DEFINED_LITERALS 1
128# define FMT_USE_USER_DEFINED_LITERALS 0
136#if !defined(FMT_REDUCE_INT_INSTANTIATIONS)
137# define FMT_REDUCE_INT_INSTANTIATIONS 0
143# if FMT_HAS_BUILTIN(__builtin_clz) || FMT_GCC_VERSION || FMT_ICC_VERSION
144# define FMT_BUILTIN_CLZ(n) __builtin_clz(n)
146# if FMT_HAS_BUILTIN(__builtin_clzll) || FMT_GCC_VERSION || FMT_ICC_VERSION
147# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
154# if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION || FMT_ICC_VERSION || \
155 defined(__NVCOMPILER)
156# define FMT_BUILTIN_CTZ(n) __builtin_ctz(n)
158# if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || \
159 FMT_ICC_VERSION || defined(__NVCOMPILER)
160# define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n)
171#if FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL) && \
172 !defined(FMT_BUILTIN_CTZLL)
176# if !defined(__clang__)
177# pragma intrinsic(_BitScanForward)
178# pragma intrinsic(_BitScanReverse)
180# pragma intrinsic(_BitScanForward64)
181# pragma intrinsic(_BitScanReverse64)
187 _BitScanReverse(&r, x);
193 return 31 ^
static_cast<int>(r);
195# define FMT_BUILTIN_CLZ(n) detail::clz(n)
197inline auto clzll(
uint64_t x) ->
int {
200 _BitScanReverse64(&r, x);
203 if (_BitScanReverse(&r,
static_cast<uint32_t>(x >> 32)))
return 63 ^ (r + 32);
205 _BitScanReverse(&r,
static_cast<uint32_t>(x));
209 return 63 ^
static_cast<int>(r);
211# define FMT_BUILTIN_CLZLL(n) detail::clzll(n)
215 _BitScanForward(&r, x);
218 return static_cast<int>(r);
220# define FMT_BUILTIN_CTZ(n) detail::ctz(n)
222inline auto ctzll(
uint64_t x) ->
int {
227 _BitScanForward64(&r, x);
230 if (_BitScanForward(&r,
static_cast<uint32_t>(x)))
return static_cast<int>(r);
232 _BitScanForward(&r,
static_cast<uint32_t>(x >> 32));
235 return static_cast<int>(r);
237# define FMT_BUILTIN_CTZLL(n) detail::ctzll(n)
248 if (condition)
throw std::runtime_error(
"fuzzing limit reached");
253 static constexpr CharT
value[
sizeof...(C)] = {C...};
255 return {
value,
sizeof...(C)};
259#if FMT_CPLUSPLUS < 201703L
260template <
typename CharT, CharT... C>
261constexpr CharT string_literal<CharT, C...>
::value[
sizeof...(C)];
264template <
typename Streambuf>
class formatbuf :
public Streambuf {
266 using char_type =
typename Streambuf::char_type;
267 using streamsize =
decltype(std::declval<Streambuf>().sputn(
nullptr, 0));
268 using int_type =
typename Streambuf::int_type;
269 using traits_type =
typename Streambuf::traits_type;
284 if (!traits_type::eq_int_type(ch, traits_type::eof()))
285 buffer_.
push_back(
static_cast<char_type
>(ch));
289 auto xsputn(
const char_type* s, streamsize
count) -> streamsize
override {
296template <
typename To,
typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))>
298#ifdef __cpp_lib_bit_cast
303 std::memcpy(
static_cast<void*
>(&to), &
from,
sizeof(to));
310#elif defined(__BIG_ENDIAN__)
312#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
313 return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__;
316 char data[
sizeof(int)];
318 return bit_cast<bytes>(1).data[0] == 0;
335 template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
336 constexpr explicit operator T()
const {
337 return static_cast<T
>(lo_);
342 return lhs.hi_ == rhs.hi_ && lhs.lo_ == rhs.lo_;
346 return !(lhs == rhs);
350 return lhs.hi_ != rhs.hi_ ? lhs.hi_ > rhs.hi_ : lhs.lo_ > rhs.lo_;
355 return {lhs.hi_ | rhs.hi_, lhs.lo_ | rhs.lo_};
360 return {lhs.hi_ & rhs.hi_, lhs.lo_ & rhs.lo_};
371 uint64_t hi = (lhs.lo_ >> 32) * rhs;
372 uint64_t lo = (lhs.lo_ & ~uint32_t()) * rhs;
374 return {(hi >> 32) + (new_lo < lo ? 1 : 0), new_lo};
378 return {lhs.hi_ - (lhs.lo_ < rhs ? 1 : 0), lhs.lo_ - rhs};
381 if (shift == 64)
return {0, hi_};
383 return {hi_ >> shift, (hi_ << (64 - shift)) | (lo_ >> shift)};
386 if (shift == 64)
return {lo_, 0};
388 return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)};
391 return *
this = *
this >> shift;
395 uint64_t new_hi = hi_ + n.hi_ + (new_lo < lo_ ? 1 : 0);
404 hi_ += (lo_ < n ? 1 : 0);
407#if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__)
408 unsigned long long carry;
409 lo_ = __builtin_addcll(lo_, n, 0, &carry);
411#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__)
412 unsigned long long result;
413 auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &
result);
416#elif defined(_MSC_VER) && defined(_M_X64)
417 auto carry = _addcarry_u64(0, lo_, n, &lo_);
418 _addcarry_u64(carry, hi_, 0, &hi_);
421 hi_ += (lo_ < n ? 1 : 0);
440template <
typename T>
constexpr auto num_bits() ->
int {
441 return std::numeric_limits<T>::digits;
449template <
typename To,
typename From, FMT_ENABLE_IF(sizeof(To) >
sizeof(From))>
451 constexpr auto size =
static_cast<int>(
sizeof(From) /
sizeof(
unsigned));
453 unsigned value[
static_cast<unsigned>(
size)];
457 for (
int i = 0; i <
size; ++i)
460 for (
int i =
size - 1; i >= 0; --i)
468#if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION
469 __builtin_assume(condition);
479template <
typename Char>
480inline auto get_data(std::basic_string<Char>& s) -> Char* {
483template <
typename Container>
484inline auto get_data(Container&
c) ->
typename Container::value_type* {
488#if defined(_SECURE_SCL) && _SECURE_SCL
490template <
typename T>
using checked_ptr = stdext::checked_array_iterator<T*>;
504template <
typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)>
505#if FMT_CLANG_VERSION >= 307 && !FMT_ICC_VERSION
506__attribute__((no_sanitize(
"undefined")))
509reserve(std::back_insert_iterator<Container> it,
size_t n)
512 size_t size =
c.size();
520 buf.try_reserve(buf.size() + n);
524template <
typename Iterator>
525constexpr auto reserve(Iterator& it,
size_t) -> Iterator& {
529template <
typename OutputIt>
533template <
typename T,
typename OutputIt>
539 auto size = buf.size();
540 if (buf.capacity() <
size + n)
return nullptr;
541 buf.try_resize(
size + n);
542 return buf.data() +
size;
545template <
typename Container, FMT_ENABLE_IF(is_contiguous<Container>::value)>
548 -> std::back_insert_iterator<Container> {
552template <
typename Iterator>
559template <
typename OutputIt,
typename Size,
typename T>
562 for (Size i = 0; i <
count; ++i) *out++ =
value;
565template <
typename T,
typename Size>
568 return fill_n<T*, Size, T>(out,
count,
value);
580template <
typename OutChar,
typename InputIt,
typename OutputIt>
582 OutputIt out) -> OutputIt {
583 return copy_str<OutChar>(
begin,
end, out);
605 constexpr const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07};
606 constexpr const uint32_t mins[] = {4194304, 0, 128, 2048, 65536};
607 constexpr const int shiftc[] = {0, 18, 12, 6, 0};
608 constexpr const int shifte[] = {0, 6, 4, 2, 0};
614 const char* next = s + len + !len;
616 using uchar =
unsigned char;
620 *
c =
uint32_t(uchar(s[0]) & masks[len]) << 18;
621 *
c |=
uint32_t(uchar(s[1]) & 0x3f) << 12;
627 *
e = (*
c < mins[len]) << 6;
628 *
e |= ((*
c >> 11) == 0x1b) << 7;
629 *
e |= (*
c > 0x10FFFF) << 8;
630 *
e |= (uchar(s[1]) & 0xc0) >> 2;
631 *
e |= (uchar(s[2]) & 0xc0) >> 4;
632 *
e |= uchar(s[3]) >> 6;
645 auto decode = [f](
const char* buf_ptr,
const char*
ptr) {
654 const size_t block_size = 4;
655 if (s.
size() >= block_size) {
656 for (
auto end = p + s.
size() - block_size + 1; p <
end;) {
661 if (
auto num_chars_left = s.
data() + s.
size() - p) {
662 char buf[2 * block_size - 1] = {};
663 copy_str<char>(p, p + num_chars_left, buf);
664 const char* buf_ptr = buf;
666 auto end = decode(buf_ptr, p);
670 }
while (buf_ptr - buf < num_chars_left);
674template <
typename Char>
681 size_t num_code_points = 0;
683 struct count_code_points {
693 (cp >= 0x2e80 && cp <= 0xa4cf && cp != 0x303f) ||
694 (cp >= 0xac00 && cp <= 0xd7a3) ||
695 (cp >= 0xf900 && cp <= 0xfaff) ||
696 (cp >= 0xfe10 && cp <= 0xfe19) ||
697 (cp >= 0xfe30 && cp <= 0xfe6f) ||
698 (cp >= 0xff00 && cp <= 0xff60) ||
699 (cp >= 0xffe0 && cp <= 0xffe6) ||
700 (cp >= 0x20000 && cp <= 0x2fffd) ||
701 (cp >= 0x30000 && cp <= 0x3fffd) ||
703 (cp >= 0x1f300 && cp <= 0x1f64f) ||
705 (cp >= 0x1f900 && cp <= 0x1f9ff))));
710 return num_code_points;
715 string_view(
reinterpret_cast<const char*
>(s.data()), s.size()));
718template <
typename Char>
720 size_t size = s.size();
726 const char*
data = s.data();
727 size_t num_code_points = 0;
728 for (
size_t i = 0,
size = s.size(); i !=
size; ++i) {
729 if ((
data[i] & 0xc0) != 0x80 && ++num_code_points > n)
return i;
737 string_view(
reinterpret_cast<const char*
>(s.data()), s.size()), n);
740#ifndef FMT_USE_FLOAT128
741# ifdef __SIZEOF_FLOAT128__
742# define FMT_USE_FLOAT128 1
744# define FMT_USE_FLOAT128 0
752template <
typename T>
using is_float128 = std::is_same<T, float128>;
758template <typename T, bool = std::is_floating_point<T>::value>
759struct is_fast_float :
bool_constant<std::numeric_limits<T>::is_iec559 &&
760 sizeof(T) <= sizeof(double)> {};
761template <typename T> struct is_fast_float<T, false> : std::false_type {};
764using is_double_double = bool_constant<std::numeric_limits<T>::digits == 106>;
766#ifndef FMT_USE_FULL_CACHE_DRAGONBOX
767# define FMT_USE_FULL_CACHE_DRAGONBOX 0
772void buffer<T>::append(const U* begin, const U* end) {
773 while (begin != end) {
774 auto count = to_unsigned(end - begin);
775 try_reserve(size_ + count);
776 auto free_cap = capacity_ - size_;
777 if (free_cap < count) count = free_cap;
778 std::uninitialized_copy_n(begin, count, make_checked(ptr_ + size_, count));
784template <typename T, typename Enable = void>
785struct is_locale : std::false_type {};
787struct is_locale<T, void_t<decltype(T::classic())>> : std::true_type {};
790FMT_MODULE_EXPORT_BEGIN
794enum { inline_buffer_size = 500 };
817template <typename T, size_t SIZE = inline_buffer_size,
818 typename Allocator = std::allocator<T>>
819class basic_memory_buffer final : public detail::buffer<T> {
827 FMT_CONSTEXPR20 void deallocate() {
828 T* data = this->data();
829 if (data != store_) alloc_.deallocate(data, this->capacity());
840 const Allocator& alloc = Allocator())
842 this->
set(store_, SIZE);
850 alloc_ = std::move(other.alloc_);
851 T*
data = other.data();
852 size_t size = other.size(), capacity = other.capacity();
853 if (
data == other.store_) {
854 this->
set(store_, capacity);
855 detail::copy_str<T>(other.store_, other.store_ +
size,
861 other.set(other.store_, 0);
900 void reserve(
size_t new_capacity) { this->try_reserve(new_capacity); }
903 using detail::buffer<T>::append;
904 template <
typename ContiguousRange>
905 void append(
const ContiguousRange& range) {
906 append(range.data(), range.data() + range.size());
910template <
typename T,
size_t SIZE,
typename Allocator>
914 const size_t max_size = std::allocator_traits<Allocator>::max_size(alloc_);
915 size_t old_capacity = this->capacity();
916 size_t new_capacity = old_capacity + old_capacity / 2;
917 if (
size > new_capacity)
919 else if (new_capacity > max_size)
920 new_capacity =
size > max_size ?
size : max_size;
921 T* old_data = this->data();
923 std::allocator_traits<Allocator>::allocate(alloc_, new_capacity);
925 std::uninitialized_copy(old_data, old_data + this->
size(),
927 this->
set(new_data, new_capacity);
931 if (old_data != store_) alloc_.deallocate(old_data, old_capacity);
936template <
typename T,
size_t SIZE,
typename Allocator>
953 :
std::runtime_error(message) {}
962#if FMT_USE_NONTYPE_TEMPLATE_ARGS
963template <
typename Char,
size_t N>
struct fixed_string {
964 constexpr fixed_string(
const Char (&str)[N]) {
965 detail::copy_str<Char, const Char*, Char*>(
static_cast<const Char*
>(str),
973template <
typename Char,
size_t N>
978 return {s, N - (std::char_traits<Char>::to_int_type(s[N - 1]) == 0 ? 1 : 0)};
980template <
typename Char>
983 return {s.
data(), s.size()};
996 std::is_same<T, int128_opt>::value>;
1000template <
typename T, FMT_ENABLE_IF(is_
signed<T>::value)>
1004template <
typename T, FMT_ENABLE_IF(!is_
signed<T>::value)>
1009template <
typename T>
1019template <
typename T>
1024template <
typename T>
1027#define FMT_POWERS_OF_10(factor) \
1028 factor * 10, (factor)*100, (factor)*1000, (factor)*10000, (factor)*100000, \
1029 (factor)*1000000, (factor)*10000000, (factor)*100000000, \
1035 return &
"0001020304050607080910111213141516171819"
1036 "2021222324252627282930313233343536373839"
1037 "4041424344454647484950515253545556575859"
1038 "6061626364656667686970717273747576777879"
1039 "8081828384858687888990919293949596979899"[
value * 2];
1043template <
typename Char,
typename Sign>
constexpr Char
sign(Sign s) {
1044#if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 604
1045 static_assert(std::is_same<Sign, sign_t>::value,
"");
1047 return static_cast<Char
>(
"\0-+ "[s]);
1056 if (n < 10)
return count;
1057 if (n < 100)
return count + 1;
1058 if (n < 1000)
return count + 2;
1059 if (n < 10000)
return count + 3;
1070#ifdef FMT_BUILTIN_CLZLL
1073inline auto do_count_digits(
uint64_t n) ->
int {
1078 static constexpr uint8_t bsr2log10[] = {
1079 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5,
1080 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10,
1081 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,
1082 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20};
1083 auto t = bsr2log10[FMT_BUILTIN_CLZLL(n | 1) ^ 63];
1084 static constexpr const uint64_t zero_or_powers_of_10[] = {
1086 10000000000000000000ULL};
1087 return t - (n < zero_or_powers_of_10[t]);
1094#ifdef FMT_BUILTIN_CLZLL
1096 return do_count_digits(n);
1103template <
int BITS,
typename UInt>
1105#ifdef FMT_BUILTIN_CLZ
1107 return (FMT_BUILTIN_CLZ(
static_cast<uint32_t>(n) | 1) ^ 31) / BITS + 1;
1114 }
while ((m >>= BITS) != 0);
1119#ifdef FMT_BUILTIN_CLZ
1125# define FMT_INC(T) (((sizeof(# T) - 1ull) << 32) - T)
1126 static constexpr uint64_t table[] = {
1127 FMT_INC(0), FMT_INC(0), FMT_INC(0),
1128 FMT_INC(10), FMT_INC(10), FMT_INC(10),
1129 FMT_INC(100), FMT_INC(100), FMT_INC(100),
1130 FMT_INC(1000), FMT_INC(1000), FMT_INC(1000),
1131 FMT_INC(10000), FMT_INC(10000), FMT_INC(10000),
1132 FMT_INC(100000), FMT_INC(100000), FMT_INC(100000),
1133 FMT_INC(1000000), FMT_INC(1000000), FMT_INC(1000000),
1134 FMT_INC(10000000), FMT_INC(10000000), FMT_INC(10000000),
1135 FMT_INC(100000000), FMT_INC(100000000), FMT_INC(100000000),
1136 FMT_INC(1000000000), FMT_INC(1000000000), FMT_INC(1000000000),
1137 FMT_INC(1000000000), FMT_INC(1000000000)
1139 auto inc = table[FMT_BUILTIN_CLZ(n | 1) ^ 31];
1140 return static_cast<int>((n + inc) >> 32);
1146#ifdef FMT_BUILTIN_CLZ
1148 return do_count_digits(n);
1154template <
typename Int>
constexpr auto digits10() noexcept ->
int {
1165template <
typename Char>
1167template <
typename Char>
1177template <
typename Char>
1180 return Char(decimal_point_impl<char>(loc));
1183 return decimal_point_impl<wchar_t>(loc);
1187template <
typename Char>
auto equal2(
const Char* lhs,
const char* rhs) ->
bool {
1188 return lhs[0] == Char(rhs[0]) && lhs[1] == Char(rhs[1]);
1190inline auto equal2(
const char* lhs,
const char* rhs) ->
bool {
1191 return memcmp(lhs, rhs, 2) == 0;
1195template <
typename Char>
1198 memcpy(dst, src, 2);
1201 *dst++ =
static_cast<Char
>(*src++);
1202 *dst =
static_cast<Char
>(*src);
1213template <
typename Char,
typename UInt>
1219 while (
value >= 100) {
1228 *--out =
static_cast<Char
>(
'0' +
value);
1236template <
typename Char,
typename UInt,
typename Iterator,
1241 Char
buffer[digits10<UInt>() + 1];
1243 return {out, detail::copy_str_noinline<Char>(
buffer,
end, out)};
1246template <
unsigned BASE_BITS,
typename Char,
typename UInt>
1248 bool upper =
false) -> Char* {
1252 const char*
digits = upper ?
"0123456789ABCDEF" :
"0123456789abcdef";
1253 unsigned digit =
static_cast<unsigned>(
value & ((1 << BASE_BITS) - 1));
1254 *--
buffer =
static_cast<Char
>(BASE_BITS < 4 ? static_cast<char>(
'0' + digit)
1256 }
while ((
value >>= BASE_BITS) != 0);
1260template <
unsigned BASE_BITS,
typename Char,
typename It,
typename UInt>
1264 format_uint<BASE_BITS>(
ptr,
value, num_digits, upper);
1268 char buffer[num_bits<UInt>() / BASE_BITS + 1];
1269 format_uint<BASE_BITS>(
buffer,
value, num_digits, upper);
1270 return detail::copy_str_noinline<Char>(
buffer,
buffer + num_digits, out);
1281 auto size() const ->
size_t {
return buffer_.size() - 1; }
1282 auto c_str() const -> const
wchar_t* {
return &buffer_[0]; }
1283 auto str() const ->
std::wstring {
return {&buffer_[0],
size()}; }
1293 static const int exponent_bits = 8;
1294 static const int kappa = 1;
1295 static const int big_divisor = 100;
1296 static const int small_divisor = 10;
1297 static const int min_k = -31;
1298 static const int max_k = 46;
1299 static const int shorter_interval_tie_lower_threshold = -35;
1300 static const int shorter_interval_tie_upper_threshold = -35;
1305 static const int exponent_bits = 11;
1306 static const int kappa = 2;
1307 static const int big_divisor = 1000;
1308 static const int small_divisor = 100;
1309 static const int min_k = -292;
1310 static const int max_k = 326;
1311 static const int shorter_interval_tie_lower_threshold = -77;
1312 static const int shorter_interval_tie_upper_threshold = -77;
1316template <
typename T>
1318 std::numeric_limits<T>::digits == 113 ||
1321 static const int exponent_bits = 15;
1325template <
typename T>
1342 return std::numeric_limits<Float>::digits != 64;
1349 return is_float128<Float>() ? 112
1350 : (std::numeric_limits<Float>::digits -
1351 (has_implicit_bit<Float>() ? 1 : 0));
1354template <
typename Float>
1359 << num_significand_bits<Float>();
1363 return is_float128<Float>() ? 16383
1364 : std::numeric_limits<Float>::max_exponent - 1;
1368template <
typename Char,
typename It>
1372 *it++ =
static_cast<Char
>(
'-');
1375 *it++ =
static_cast<Char
>(
'+');
1379 if (
exp >= 1000) *it++ =
static_cast<Char
>(top[0]);
1380 *it++ =
static_cast<Char
>(top[1]);
1384 *it++ =
static_cast<Char
>(d[0]);
1385 *it++ =
static_cast<Char
>(d[1]);
1395 static_cast<int>(
sizeof(
F) * num_bits<unsigned char>());
1404 template <
typename Float, FMT_ENABLE_IF(!is_
double_
double<Float>::value)>
1406 static_assert(std::numeric_limits<Float>::digits <= 113,
"unsupported FP");
1409 const auto num_float_significand_bits =
1410 detail::num_significand_bits<Float>();
1411 const auto implicit_bit = carrier_uint(1) << num_float_significand_bits;
1412 const auto significand_mask = implicit_bit - 1;
1413 auto u = bit_cast<carrier_uint>(n);
1414 f =
static_cast<F>(u & significand_mask);
1415 auto biased_e =
static_cast<int>((u & exponent_mask<Float>()) >>
1416 num_float_significand_bits);
1419 auto is_predecessor_closer = f == 0 && biased_e > 1;
1422 else if (has_implicit_bit<Float>())
1423 f +=
static_cast<F>(implicit_bit);
1424 e = biased_e - exponent_bias<Float>() - num_float_significand_bits;
1425 if (!has_implicit_bit<Float>()) ++
e;
1426 return is_predecessor_closer;
1429 template <
typename Float, FMT_ENABLE_IF(is_
double_
double<Float>::value)>
1431 static_assert(std::numeric_limits<double>::is_iec559,
"unsupported FP");
1432 return assign(
static_cast<double>(n));
1439template <
int SHIFT = 0,
typename F>
1442 const auto implicit_bit =
F(1) << num_significand_bits<double>();
1443 const auto shifted_implicit_bit = implicit_bit << SHIFT;
1444 while ((
value.f & shifted_implicit_bit) == 0) {
1450 num_significand_bits<double>() - SHIFT - 1;
1459 auto product =
static_cast<__uint128_t
>(lhs) * rhs;
1460 auto f =
static_cast<uint64_t>(product >> 64);
1461 return (
static_cast<uint64_t>(product) & (1ULL << 63)) != 0 ? f + 1 : f;
1467 uint64_t ac = a *
c, bc =
b *
c, ad = a * d, bd =
b * d;
1469 uint64_t mid = (bd >> 32) + (ad & mask) + (bc & mask) + (1U << 31);
1470 return ac + (ad >> 32) + (bc >> 32) + (mid >> 32);
1482 0xfa8fd5a0081c0288, 0xbaaee17fa23ebf76, 0x8b16fb203055ac76,
1483 0xcf42894a5dce35ea, 0x9a6bb0aa55653b2d, 0xe61acf033d1a45df,
1484 0xab70fe17c79ac6ca, 0xff77b1fcbebcdc4f, 0xbe5691ef416bd60c,
1485 0x8dd01fad907ffc3c, 0xd3515c2831559a83, 0x9d71ac8fada6c9b5,
1486 0xea9c227723ee8bcb, 0xaecc49914078536d, 0x823c12795db6ce57,
1487 0xc21094364dfb5637, 0x9096ea6f3848984f, 0xd77485cb25823ac7,
1488 0xa086cfcd97bf97f4, 0xef340a98172aace5, 0xb23867fb2a35b28e,
1489 0x84c8d4dfd2c63f3b, 0xc5dd44271ad3cdba, 0x936b9fcebb25c996,
1490 0xdbac6c247d62a584, 0xa3ab66580d5fdaf6, 0xf3e2f893dec3f126,
1491 0xb5b5ada8aaff80b8, 0x87625f056c7c4a8b, 0xc9bcff6034c13053,
1492 0x964e858c91ba2655, 0xdff9772470297ebd, 0xa6dfbd9fb8e5b88f,
1493 0xf8a95fcf88747d94, 0xb94470938fa89bcf, 0x8a08f0f8bf0f156b,
1494 0xcdb02555653131b6, 0x993fe2c6d07b7fac, 0xe45c10c42a2b3b06,
1495 0xaa242499697392d3, 0xfd87b5f28300ca0e, 0xbce5086492111aeb,
1496 0x8cbccc096f5088cc, 0xd1b71758e219652c, 0x9c40000000000000,
1497 0xe8d4a51000000000, 0xad78ebc5ac620000, 0x813f3978f8940984,
1498 0xc097ce7bc90715b3, 0x8f7e32ce7bea5c70, 0xd5d238a4abe98068,
1499 0x9f4f2726179a2245, 0xed63a231d4c4fb27, 0xb0de65388cc8ada8,
1500 0x83c7088e1aab65db, 0xc45d1df942711d9a, 0x924d692ca61be758,
1501 0xda01ee641a708dea, 0xa26da3999aef774a, 0xf209787bb47d6b85,
1502 0xb454e4a179dd1877, 0x865b86925b9bc5c2, 0xc83553c5c8965d3d,
1503 0x952ab45cfa97a0b3, 0xde469fbd99a05fe3, 0xa59bc234db398c25,
1504 0xf6c69a72a3989f5c, 0xb7dcbf5354e9bece, 0x88fcf317f22241e2,
1505 0xcc20ce9bd35c78a5, 0x98165af37b2153df, 0xe2a0b5dc971f303a,
1506 0xa8d9d1535ce3b396, 0xfb9b7cd9a4a7443c, 0xbb764c4ca7a44410,
1507 0x8bab8eefb6409c1a, 0xd01fef10a657842c, 0x9b10a4e5e9913129,
1508 0xe7109bfba19c0c9d, 0xac2820d9623bf429, 0x80444b5e7aa7cf85,
1509 0xbf21e44003acdd2d, 0x8e679c2f5e44ff8f, 0xd433179d9c8cb841,
1510 0x9e19db92b4e31ba9, 0xeb96bf6ebadf77d9, 0xaf87023b9bf0ee6b,
1513#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
1514# pragma GCC diagnostic push
1515# pragma GCC diagnostic ignored "-Wnarrowing"
1520 -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, -954,
1521 -927, -901, -874, -847, -821, -794, -768, -741, -715, -688, -661,
1522 -635, -608, -582, -555, -529, -502, -475, -449, -422, -396, -369,
1523 -343, -316, -289, -263, -236, -210, -183, -157, -130, -103, -77,
1524 -50, -24, 3, 30, 56, 83, 109, 136, 162, 189, 216,
1525 242, 269, 295, 322, 348, 375, 402, 428, 455, 481, 508,
1526 534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800,
1527 827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066};
1528#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
1529# pragma GCC diagnostic pop
1534 10000000000000000000ULL};
1537#if FMT_CPLUSPLUS < 201703L
1549 int& pow10_exponent) {
1550 const int shift = 32;
1552 const int64_t significand = 0x4d104d427de7fbcc;
1553 int index =
static_cast<int>(
1559 const int first_dec_exp = -348;
1561 const int dec_exp_step = 8;
1562 index = (
index - first_dec_exp - 1) / dec_exp_step + 1;
1563 pow10_exponent = first_dec_exp +
index * dec_exp_step;
1571# define FMT_SNPRINTF snprintf
1573FMT_API auto fmt_snprintf(
char* buf,
size_t size,
const char* fmt, ...) -> int;
1574# define FMT_SNPRINTF fmt_snprintf
1578template <
typename T>
1582 FMT_ASSERT(buf.capacity() > buf.size(),
"empty buffer");
1584 static_assert(!std::is_same<T, float>::value,
"");
1588 char* format_ptr =
format;
1589 *format_ptr++ =
'%';
1590 if (specs.showpoint) *format_ptr++ =
'#';
1591 if (precision >= 0) {
1592 *format_ptr++ =
'.';
1593 *format_ptr++ =
'*';
1595 if (std::is_same<T, long double>()) *format_ptr++ =
'L';
1596 *format_ptr++ = specs.upper ?
'A' :
'a';
1600 auto offset = buf.size();
1602 auto begin = buf.data() + offset;
1603 auto capacity = buf.capacity() - offset;
1607 int (*snprintf_ptr)(
char*, size_t,
const char*, ...) =
FMT_SNPRINTF;
1608 int result = precision >= 0
1613 buf.try_reserve(buf.capacity() + 1);
1618 if (
size < capacity) {
1619 buf.try_resize(
size + offset);
1622 buf.try_reserve(
size + offset + 1);
1626template <
typename T>
1631template <
typename T>
1636template <
typename OutputIt,
typename Char>
1639 auto fill_size =
fill.size();
1642 for (
size_t i = 0; i < n; ++i)
1643 it = copy_str<Char>(
data,
data + fill_size, it);
1650template <
align::type align = align::left,
typename OutputIt,
typename Char,
1654 size_t size,
size_t width,
F&& f) -> OutputIt {
1655 static_assert(
align == align::left ||
align == align::right,
"");
1657 size_t padding = spec_width > width ? spec_width - width : 0;
1660 auto* shifts =
align == align::left ?
"\x1f\x1f\x00\x01" :
"\x00\x1f\x00\x01";
1661 size_t left_padding = padding >> shifts[specs.align];
1662 size_t right_padding = padding - left_padding;
1663 auto it =
reserve(out,
size + padding * specs.fill.size());
1664 if (left_padding != 0) it =
fill(it, left_padding, specs.fill);
1666 if (right_padding != 0) it =
fill(it, right_padding, specs.fill);
1670template <
align::type align = align::left,
typename OutputIt,
typename Char,
1673 size_t size,
F&& f) -> OutputIt {
1674 return write_padded<align>(out, specs,
size,
size, f);
1677template <align::type align = align::left,
typename Char,
typename OutputIt>
1681 return write_padded<align>(
1682 out, specs,
bytes.size(), [
bytes](reserve_iterator<OutputIt> it) {
1683 const char* data = bytes.data();
1684 return copy_str<Char>(data, data + bytes.size(), it);
1688template <
typename Char,
typename OutputIt,
typename UIntPtr>
1691 int num_digits = count_digits<4>(
value);
1693 auto write = [=](reserve_iterator<OutputIt> it) {
1694 *it++ =
static_cast<Char
>(
'0');
1695 *it++ =
static_cast<Char
>(
'x');
1696 return format_uint<4, Char>(it,
value, num_digits);
1698 return specs ? write_padded<align::right>(out, *specs,
size,
write)
1706 return cp < 0x20 || cp == 0x7f || cp ==
'"' || cp ==
'\\' ||
1716template <
typename Char>
1719 std::make_unsigned<Char>,
1722template <
typename Char>
1727 if (
const_check(
sizeof(Char) == 1) && cp >= 0x80)
continue;
1730 return {
begin,
nullptr, 0};
1748#define FMT_STRING_IMPL(s, base, explicit) \
1752 struct FMT_GCC_VISIBILITY_HIDDEN FMT_COMPILE_STRING : base { \
1753 using char_type FMT_MAYBE_UNUSED = fmt::remove_cvref_t<decltype(s[0])>; \
1754 FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit \
1755 operator fmt::basic_string_view<char_type>() const { \
1756 return fmt::detail_exported::compile_string_to_view<char_type>(s); \
1759 return FMT_COMPILE_STRING(); \
1772#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, )
1774template <
size_t w
idth,
typename Char,
typename OutputIt>
1776 *out++ =
static_cast<Char
>(
'\\');
1777 *out++ =
static_cast<Char
>(prefix);
1779 fill_n(buf, width,
static_cast<Char
>(
'0'));
1780 format_uint<4>(buf, cp, width);
1781 return copy_str<Char>(buf, buf + width, out);
1784template <
typename OutputIt,
typename Char>
1787 auto c =
static_cast<Char
>(escape.cp);
1788 switch (escape.cp) {
1790 *out++ =
static_cast<Char
>(
'\\');
1791 c =
static_cast<Char
>(
'n');
1794 *out++ =
static_cast<Char
>(
'\\');
1795 c =
static_cast<Char
>(
'r');
1798 *out++ =
static_cast<Char
>(
'\\');
1799 c =
static_cast<Char
>(
't');
1806 *out++ =
static_cast<Char
>(
'\\');
1810 if (escape.cp < 0x100) {
1811 return write_codepoint<2, Char>(out,
'x', escape.cp);
1813 if (escape.cp < 0x10000) {
1814 return write_codepoint<4, Char>(out,
'u', escape.cp);
1816 if (escape.cp < 0x110000) {
1817 return write_codepoint<8, Char>(out,
'U', escape.cp);
1821 escape.begin,
to_unsigned(escape.end - escape.begin))) {
1822 out = write_codepoint<2, Char>(out,
'x',
1823 static_cast<uint32_t>(escape_char) & 0xFF);
1831template <
typename Char,
typename OutputIt>
1834 *out++ =
static_cast<Char
>(
'"');
1835 auto begin = str.begin(),
end = str.end();
1838 out = copy_str<Char>(
begin, escape.begin, out);
1841 out = write_escaped_cp<OutputIt, Char>(out, escape);
1843 *out++ =
static_cast<Char
>(
'"');
1847template <
typename Char,
typename OutputIt>
1849 *out++ =
static_cast<Char
>(
'\'');
1851 v ==
static_cast<Char
>(
'\'')) {
1857 *out++ =
static_cast<Char
>(
'\'');
1861template <
typename Char,
typename OutputIt>
1866 return write_padded(out, specs, 1, [=](reserve_iterator<OutputIt> it) {
1872template <
typename Char,
typename OutputIt>
1878 :
write(out, static_cast<int>(
value), specs, loc);
1890 if (specs.
align == align::numeric) {
1893 padding = width -
size;
1896 }
else if (specs.
precision > num_digits) {
1907template <
typename OutputIt,
typename Char,
typename W>
1911 W write_digits) -> OutputIt {
1916 for (
unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
1917 *it++ =
static_cast<Char
>(p & 0xff);
1922 return write_padded<align::right>(
1923 out, specs,
data.size, [=](reserve_iterator<OutputIt> it) {
1924 for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
1925 *it++ = static_cast<Char>(p & 0xff);
1926 it = detail::fill_n(it, data.padding, static_cast<Char>(
'0'));
1927 return write_digits(it);
1936 std::string::const_iterator group;
1939 next_state initial_state()
const {
return {sep_.
grouping.begin(), 0}; }
1942 int next(next_state& state)
const {
1944 if (state.group == sep_.
grouping.end())
1945 return state.pos += sep_.
grouping.back();
1946 if (*state.group <= 0 || *state.group == max_value<char>())
1947 return max_value<int>();
1948 state.pos += *state.group++;
1955 sep_ = thousands_sep<Char>(loc);
1965 auto state = initial_state();
1966 while (num_digits > next(state)) ++
count;
1971 template <
typename Out,
typename C>
1973 auto num_digits =
static_cast<int>(
digits.size());
1975 separators.push_back(0);
1976 auto state = initial_state();
1977 while (
int i = next(state)) {
1978 if (i >= num_digits)
break;
1979 separators.push_back(i);
1981 for (
int i = 0, sep_index =
static_cast<int>(separators.size() - 1);
1982 i < num_digits; ++i) {
1983 if (num_digits - i == separators[sep_index]) {
1984 *out++ = separator();
1993template <
typename OutputIt,
typename UInt,
typename Char>
1997 static_assert(std::is_same<uint64_or_128_t<UInt>, UInt>
::value,
"");
2002 grouping.count_separators(num_digits));
2003 return write_padded<align::right>(
2004 out, specs,
size,
size, [&](reserve_iterator<OutputIt> it) {
2006 char sign =
static_cast<char>(prefix);
2007 *it++ =
static_cast<Char
>(
sign);
2013template <
typename OutputIt,
typename UInt,
typename Char>
2024 prefix += (1u + (
value > 0xff ? 1 : 0)) << 24;
2032template <
typename T>
2038 prefix = 0x01000000 |
'-';
2039 abs_value = 0 - abs_value;
2041 constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u |
'+',
2043 prefix = prefixes[
sign];
2045 return {abs_value, prefix};
2048template <
typename Char,
typename OutputIt,
typename T>
2052 static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>
::value,
"");
2053 auto abs_value =
arg.abs_value;
2054 auto prefix =
arg.prefix;
2055 switch (specs.
type) {
2060 prefix, specs, loc)) {
2065 out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {
2066 return format_decimal<Char>(it, abs_value, num_digits).end;
2073 prefix_append(prefix,
unsigned(upper ?
'X' :
'x') << 8 |
'0');
2074 int num_digits = count_digits<4>(abs_value);
2076 out, num_digits, prefix, specs, [=](reserve_iterator<OutputIt> it) {
2077 return format_uint<4, Char>(it, abs_value, num_digits, upper);
2084 prefix_append(prefix,
unsigned(upper ?
'B' :
'b') << 8 |
'0');
2085 int num_digits = count_digits<1>(abs_value);
2086 return write_int(out, num_digits, prefix, specs,
2087 [=](reserve_iterator<OutputIt> it) {
2088 return format_uint<1, Char>(it, abs_value, num_digits);
2092 int num_digits = count_digits<3>(abs_value);
2095 if (specs.
alt && specs.
precision <= num_digits && abs_value != 0)
2097 return write_int(out, num_digits, prefix, specs,
2098 [=](reserve_iterator<OutputIt> it) {
2099 return format_uint<3, Char>(it, abs_value, num_digits);
2103 return write_char(out,
static_cast<Char
>(abs_value), specs);
2109template <
typename Char,
typename OutputIt,
typename T>
2115template <
typename Char,
typename OutputIt,
typename T,
2117 !std::is_same<T, bool>::value &&
2126template <
typename Char,
typename OutputIt,
typename T,
2128 !std::is_same<T, bool>::value &&
2169 it.count_ +=
static_cast<size_t>(n);
2176template <
typename Char,
typename OutputIt>
2179 auto data = s.data();
2180 auto size = s.size();
2185 if (specs.
width != 0) {
2192 [=](reserve_iterator<OutputIt> it) {
2197template <
typename Char,
typename OutputIt>
2203 return write(out, s, specs);
2205template <
typename Char,
typename OutputIt>
2211 : write_ptr<Char>(out, bit_cast<uintptr_t>(s), &specs);
2214template <
typename Char,
typename OutputIt,
typename T,
2216 !std::is_same<T, bool>::value &&
2217 !std::is_same<T, Char>::value)>
2222 if (negative) abs_value = ~abs_value + 1;
2224 auto size = (negative ? 1 : 0) +
static_cast<size_t>(num_digits);
2226 if (
auto ptr = to_pointer<Char>(it,
size)) {
2227 if (negative) *
ptr++ =
static_cast<Char
>(
'-');
2228 format_decimal<Char>(
ptr, abs_value, num_digits);
2231 if (negative) *it++ =
static_cast<Char
>(
'-');
2232 it = format_decimal<Char>(it, abs_value, num_digits).end;
2236template <
typename Char,
typename OutputIt>
2241 isnan ? (fspecs.upper ?
"NAN" :
"nan") : (fspecs.upper ?
"INF" :
"inf");
2242 constexpr size_t str_size = 3;
2243 auto sign = fspecs.sign;
2244 auto size = str_size + (
sign ? 1 : 0);
2246 const bool is_zero_fill =
2247 specs.
fill.size() == 1 && *specs.
fill.data() ==
static_cast<Char
>(
'0');
2248 if (is_zero_fill) specs.
fill[0] =
static_cast<Char
>(
' ');
2250 if (
sign) *it++ = detail::sign<Char>(
sign);
2251 return copy_str<Char>(str, str + str_size, it);
2263 return f.significand_size;
2265template <
typename T>
2270template <
typename Char,
typename OutputIt>
2272 int significand_size) -> OutputIt {
2273 return copy_str<Char>(significand, significand + significand_size, out);
2275template <
typename Char,
typename OutputIt,
typename UInt>
2277 int significand_size) -> OutputIt {
2278 return format_decimal<Char>(out, significand, significand_size).end;
2280template <
typename Char,
typename OutputIt,
typename T,
typename Grouping>
2282 int significand_size,
int exponent,
2283 const Grouping& grouping) -> OutputIt {
2284 if (!grouping.separator()) {
2285 out = write_significand<Char>(out, significand, significand_size);
2289 write_significand<char>(
appender(
buffer), significand, significand_size);
2294template <
typename Char,
typename UInt,
2300 out += significand_size + 1;
2302 int floating_size = significand_size - integral_size;
2303 for (
int i = floating_size / 2; i > 0; --i) {
2305 copy2(out,
digits2(
static_cast<std::size_t
>(significand % 100)));
2308 if (floating_size % 2 != 0) {
2309 *--out =
static_cast<Char
>(
'0' + significand % 10);
2317template <
typename OutputIt,
typename UInt,
typename Char,
2320 int significand_size,
int integral_size,
2323 Char
buffer[digits10<UInt>() + 2];
2326 return detail::copy_str_noinline<Char>(
buffer,
end, out);
2329template <
typename OutputIt,
typename Char>
2331 int significand_size,
int integral_size,
2333 out = detail::copy_str_noinline<Char>(significand,
2334 significand + integral_size, out);
2337 return detail::copy_str_noinline<Char>(significand + integral_size,
2338 significand + significand_size, out);
2341template <
typename OutputIt,
typename Char,
typename T,
typename Grouping>
2343 int significand_size,
int integral_size,
2345 const Grouping& grouping) -> OutputIt {
2346 if (!grouping.separator()) {
2355 return detail::copy_str_noinline<Char>(
buffer.
data() + integral_size,
2359template <
typename OutputIt,
typename DecimalFP,
typename Char,
2365 auto significand = f.significand;
2367 const Char zero =
static_cast<Char
>(
'0');
2368 auto sign = fspecs.sign;
2370 using iterator = reserve_iterator<OutputIt>;
2373 fspecs.locale ? detail::decimal_point<Char>(loc) :
static_cast<Char
>(
'.');
2375 int output_exp = f.exponent + significand_size - 1;
2376 auto use_exp_format = [=]() {
2383 output_exp >= (fspecs.precision > 0 ? fspecs.precision :
exp_upper);
2385 if (use_exp_format()) {
2387 if (fspecs.showpoint) {
2388 num_zeros = fspecs.precision - significand_size;
2389 if (num_zeros < 0) num_zeros = 0;
2391 }
else if (significand_size == 1) {
2394 auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp;
2396 if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3;
2399 char exp_char = fspecs.upper ?
'E' :
'e';
2400 auto write = [=](iterator it) {
2401 if (
sign) *it++ = detail::sign<Char>(
sign);
2406 *it++ =
static_cast<Char
>(exp_char);
2407 return write_exponent<Char>(output_exp, it);
2409 return specs.
width > 0 ? write_padded<align::right>(out, specs,
size,
write)
2413 int exp = f.exponent + significand_size;
2414 if (f.exponent >= 0) {
2417 int num_zeros = fspecs.precision -
exp;
2419 if (fspecs.showpoint) {
2424 auto grouping = Grouping(loc, fspecs.locale);
2426 return write_padded<align::right>(out, specs,
size, [&](iterator it) {
2427 if (
sign) *it++ = detail::sign<Char>(
sign);
2428 it = write_significand<Char>(it, significand, significand_size,
2429 f.exponent, grouping);
2430 if (!fspecs.showpoint)
return it;
2434 }
else if (
exp > 0) {
2436 int num_zeros = fspecs.showpoint ? fspecs.precision - significand_size : 0;
2438 auto grouping = Grouping(loc, fspecs.locale);
2440 return write_padded<align::right>(out, specs,
size, [&](iterator it) {
2441 if (
sign) *it++ = detail::sign<Char>(
sign);
2448 int num_zeros = -
exp;
2449 if (significand_size == 0 && fspecs.precision >= 0 &&
2450 fspecs.precision < num_zeros) {
2451 num_zeros = fspecs.precision;
2453 bool pointy = num_zeros != 0 || significand_size != 0 || fspecs.showpoint;
2455 return write_padded<align::right>(out, specs,
size, [&](iterator it) {
2456 if (
sign) *it++ = detail::sign<Char>(
sign);
2458 if (!pointy)
return it;
2461 return write_significand<Char>(it, significand, significand_size);
2473 template <
typename Out,
typename C>
2479template <
typename OutputIt,
typename DecimalFP,
typename Char>
2497template <
typename T,
typename Enable =
void>
2500template <
typename T>
2502 : std::true_type {};
2504template <
typename T, FMT_ENABLE_IF(std::is_
floating_po
int<T>::value&&
2505 has_isfinite<T>::value)>
2507 constexpr T inf = T(std::numeric_limits<double>::infinity());
2512template <
typename T, FMT_ENABLE_IF(!has_isfinite<T>::value)>
2514 T inf = T(std::numeric_limits<double>::infinity());
2519template <
typename T, FMT_ENABLE_IF(is_
floating_po
int<T>::value)>
2522#ifdef __cpp_if_constexpr
2523 if constexpr (std::numeric_limits<double>::is_iec559) {
2524 auto bits = detail::bit_cast<uint64_t>(
static_cast<double>(
value));
2525 return (
bits >> (num_bits<uint64_t>() - 1)) != 0;
2548 if (remainder >=
error &&
2574 buf[
size++] = digit;
2589 for (
int i =
size - 1; i > 0 && buf[i] >
'9'; --i) {
2607 if (exp10 > 0 && precision > max_value<int>() - exp10)
2630 if (handler.fixed) {
2634 if (handler.precision <= 0) {
2655 divmod_integral(1000000000);
2658 divmod_integral(100000000);
2661 divmod_integral(10000000);
2664 divmod_integral(1000000);
2667 divmod_integral(100000);
2670 divmod_integral(10000);
2673 divmod_integral(1000);
2676 divmod_integral(100);
2679 divmod_integral(10);
2686 FMT_ASSERT(
false,
"invalid number of digits");
2689 auto remainder = (
static_cast<uint64_t>(integral) << -one.
e) + fractional;
2690 auto result = handler.on_digit(
static_cast<char>(
'0' + digit),
2692 remainder,
error,
true);
2699 char digit =
static_cast<char>(
'0' + (fractional >> -one.
e));
2700 fractional &= one.
f - 1;
2702 auto result = handler.on_digit(digit, one.
f, fractional,
error,
false);
2713 enum { bigits_capacity = 32 };
2724 static constexpr const int bigit_bits = num_bits<bigit>();
2729 auto result =
static_cast<double_bigit
>((*this)[
index]) - other - borrow;
2731 borrow =
static_cast<bigit
>(
result >> (bigit_bits * 2 - 1));
2735 int num_bigits =
static_cast<int>(bigits_.size()) - 1;
2736 while (num_bigits > 0 && (*
this)[num_bigits] == 0) --num_bigits;
2742 FMT_ASSERT(other.exp_ >= exp_,
"unaligned bigints");
2745 int i = other.exp_ - exp_;
2746 for (
size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j)
2747 subtract_bigits(i, other.bigits_[j], borrow);
2748 while (borrow > 0) subtract_bigits(i, 0, borrow);
2749 remove_leading_zeros();
2753 const double_bigit wide_value =
value;
2755 for (
size_t i = 0, n = bigits_.size(); i < n; ++i) {
2756 double_bigit
result = bigits_[i] * wide_value + carry;
2757 bigits_[i] =
static_cast<bigit
>(
result);
2758 carry =
static_cast<bigit
>(
result >> bigit_bits);
2760 if (carry != 0) bigits_.push_back(carry);
2763 template <
typename UInt, FMT_ENABLE_IF(std::is_same<UInt, u
int64_t>::value ||
2764 std::is_same<UInt, u
int128_t>::value)>
2768 const int shift = num_bits<half_uint>() - bigit_bits;
2769 const UInt lower =
static_cast<half_uint
>(
value);
2770 const UInt upper =
value >> num_bits<half_uint>();
2772 for (
size_t i = 0, n = bigits_.size(); i < n; ++i) {
2773 UInt
result = lower * bigits_[i] +
static_cast<bigit
>(carry);
2774 carry = (upper * bigits_[i] << shift) + (
result >> bigit_bits) +
2775 (carry >> bigit_bits);
2776 bigits_[i] =
static_cast<bigit
>(
result);
2778 while (carry != 0) {
2779 bigits_.push_back(
static_cast<bigit
>(carry));
2780 carry >>= bigit_bits;
2784 template <
typename UInt, FMT_ENABLE_IF(std::is_same<UInt, u
int64_t>::value ||
2785 std::is_same<UInt, u
int128_t>::value)>
2787 size_t num_bigits = 0;
2789 bigits_[num_bigits++] =
static_cast<bigit
>(n);
2792 bigits_.
resize(num_bigits);
2804 auto size = other.bigits_.size();
2806 auto data = other.bigits_.data();
2817 return static_cast<int>(bigits_.size()) + exp_;
2822 exp_ += shift / bigit_bits;
2823 shift %= bigit_bits;
2824 if (shift == 0)
return *
this;
2826 for (
size_t i = 0, n = bigits_.size(); i < n; ++i) {
2827 bigit
c = bigits_[i] >> (bigit_bits - shift);
2828 bigits_[i] = (bigits_[i] << shift) + carry;
2831 if (carry != 0) bigits_.push_back(carry);
2843 if (num_lhs_bigits != num_rhs_bigits)
2844 return num_lhs_bigits > num_rhs_bigits ? 1 : -1;
2845 int i =
static_cast<int>(lhs.bigits_.size()) - 1;
2846 int j =
static_cast<int>(rhs.bigits_.size()) - 1;
2849 for (; i >=
end; --i, --j) {
2850 bigit lhs_bigit = lhs[i], rhs_bigit = rhs[j];
2851 if (lhs_bigit != rhs_bigit)
return lhs_bigit > rhs_bigit ? 1 : -1;
2853 if (i != j)
return i > j ? 1 : -1;
2860 auto minimum = [](
int a,
int b) {
return a <
b ? a :
b; };
2861 auto maximum = [](
int a,
int b) {
return a >
b ? a :
b; };
2864 if (max_lhs_bigits + 1 < num_rhs_bigits)
return -1;
2865 if (max_lhs_bigits > num_rhs_bigits)
return 1;
2866 auto get_bigit = [](
const bigint& n,
int i) -> bigit {
2867 return i >= n.exp_ && i < n.
num_bigits() ? n[i - n.exp_] : 0;
2869 double_bigit borrow = 0;
2870 int min_exp = minimum(minimum(lhs1.exp_, lhs2.exp_), rhs.exp_);
2871 for (
int i = num_rhs_bigits - 1; i >= min_exp; --i) {
2873 static_cast<double_bigit
>(get_bigit(lhs1, i)) + get_bigit(lhs2, i);
2874 bigit rhs_bigit = get_bigit(rhs, i);
2875 if (sum > rhs_bigit + borrow)
return 1;
2876 borrow = rhs_bigit + borrow - sum;
2877 if (borrow > 1)
return -1;
2878 borrow <<= bigit_bits;
2880 return borrow != 0 ? -1 : 0;
2886 if (
exp == 0)
return *
this = 1;
2889 while (
exp >= bitmask) bitmask <<= 1;
2895 while (bitmask != 0) {
2897 if ((
exp & bitmask) != 0) *
this *= 5;
2904 int num_bigits =
static_cast<int>(bigits_.size());
2905 int num_result_bigits = 2 * num_bigits;
2909 for (
int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) {
2912 for (
int i = 0, j = bigit_index; j >= 0; ++i, --j) {
2914 sum +=
static_cast<double_bigit
>(n[i]) * n[j];
2916 (*this)[bigit_index] =
static_cast<bigit
>(sum);
2917 sum >>= num_bits<bigit>();
2920 for (
int bigit_index = num_bigits; bigit_index < num_result_bigits;
2922 for (
int j = num_bigits - 1, i = bigit_index - j; i < num_bigits;)
2923 sum +=
static_cast<double_bigit
>(n[i++]) * n[j--];
2924 (*this)[bigit_index] =
static_cast<bigit
>(sum);
2925 sum >>= num_bits<bigit>();
2927 remove_leading_zeros();
2934 int exp_difference = exp_ - other.exp_;
2935 if (exp_difference <= 0)
return;
2936 int num_bigits =
static_cast<int>(bigits_.size());
2938 for (
int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j)
2939 bigits_[j] = bigits_[i];
2940 std::uninitialized_fill_n(bigits_.data(), exp_difference, 0);
2941 exp_ -= exp_difference;
2948 if (compare(*
this,
divisor) < 0)
return 0;
2955 }
while (compare(*
this,
divisor) >= 0);
2971 unsigned flags,
int num_digits,
2983 int shift = is_predecessor_closer ? 2 : 1;
2985 numerator =
value.f;
2986 numerator <<=
value.e + shift;
2989 if (is_predecessor_closer) {
2991 upper_store <<=
value.e + 1;
2992 upper = &upper_store;
2995 denominator <<= shift;
2996 }
else if (exp10 < 0) {
2998 lower.assign(numerator);
2999 if (is_predecessor_closer) {
3000 upper_store.assign(numerator);
3002 upper = &upper_store;
3004 numerator *=
value.f;
3005 numerator <<= shift;
3007 denominator <<= shift -
value.e;
3009 numerator =
value.f;
3010 numerator <<= shift;
3012 denominator <<= shift -
value.e;
3014 if (is_predecessor_closer) {
3015 upper_store = 1ULL << 1;
3016 upper = &upper_store;
3019 int even =
static_cast<int>((
value.f & 1) == 0);
3020 if (!upper) upper = &lower;
3022 if (add_compare(numerator, *upper, denominator) + even <= 0) {
3025 if (num_digits < 0) {
3027 if (upper != &lower) *upper *= 10;
3033 if (num_digits < 0) {
3039 bool low = compare(numerator, lower) - even < 0;
3041 bool high = add_compare(numerator, *upper, denominator) + even > 0;
3042 data[num_digits++] =
static_cast<char>(
'0' + digit);
3045 ++
data[num_digits - 1];
3047 int result = add_compare(numerator, numerator, denominator);
3050 ++
data[num_digits - 1];
3053 exp10 -= num_digits - 1;
3058 if (upper != &lower) *upper *= 10;
3062 exp10 -= num_digits - 1;
3063 if (num_digits == 0) {
3065 auto digit = add_compare(numerator, numerator, denominator) > 0 ?
'1' :
'0';
3070 for (
int i = 0; i < num_digits - 1; ++i) {
3072 buf[i] =
static_cast<char>(
'0' + digit);
3076 auto result = add_compare(numerator, numerator, denominator);
3079 const auto overflow =
'0' + 10;
3080 buf[num_digits - 1] = overflow;
3082 for (
int i = num_digits - 1; i > 0 && buf[i] == overflow; --i) {
3086 if (buf[0] == overflow) {
3094 buf[num_digits - 1] =
static_cast<char>(
'0' + digit);
3097template <
typename Float>
3101 static_assert(!std::is_same<Float, float>::value,
"");
3107 if (precision <= 0 || !
fixed) {
3112 fill_n(buf.data(), precision,
'0');
3117 bool use_dragon =
true;
3118 unsigned dragon_flags = 0;
3119 if (!is_fast_float<Float>()) {
3120 const auto inv_log2_10 = 0.3010299956639812;
3127 exp =
static_cast<int>(
3128 std::ceil((f.e + count_digits<1>(f.f) - 1) * inv_log2_10 - 1
e-10));
3132 if (specs.binary32) {
3135 return dec.exponent;
3139 return dec.exponent;
3143 const int min_exp = -60;
3144 int cached_exp10 = 0;
3148 normalized = normalized * cached_pow;
3152 exp += handler.exp10;
3156 exp += handler.size - cached_exp10 - 1;
3157 precision = handler.precision;
3162 bool is_predecessor_closer = specs.binary32
3163 ? f.assign(
static_cast<float>(
value))
3164 : f.assign(converted_value);
3169 const int max_double_digits = 767;
3170 if (precision > max_double_digits) precision = max_double_digits;
3173 if (!
fixed && !specs.showpoint) {
3175 auto num_digits = buf.size();
3176 while (num_digits > 0 && buf[num_digits - 1] ==
'0') {
3180 buf.try_resize(num_digits);
3185template <
typename Char,
typename OutputIt,
typename T,
3194 fspecs.
sign = sign::minus;
3196 }
else if (fspecs.
sign == sign::minus) {
3197 fspecs.
sign = sign::none;
3203 if (specs.
align == align::numeric && fspecs.
sign) {
3205 *it++ = detail::sign<Char>(fspecs.
sign);
3207 fspecs.
sign = sign::none;
3222 if (precision == max_value<int>())
3236template <
typename Char,
typename OutputIt,
typename T,
3245 fspecs.
sign = sign::minus;
3252 uint mask = exponent_mask<floaty>();
3253 if ((bit_cast<uint>(
value) & mask) == mask)
3260template <
typename Char,
typename OutputIt,
typename T,
3262 !is_fast_float<T>::value)>
3267template <
typename Char,
typename OutputIt>
3274template <
typename Char,
typename OutputIt>
3278 it = copy_str_noinline<Char>(
value.begin(),
value.end(), it);
3282template <
typename Char,
typename OutputIt,
typename T,
3290 typename Char,
typename OutputIt,
typename T,
3292 std::is_enum<T>::value && !std::is_same<T, Char>::value &&
3300template <
typename Char,
typename OutputIt,
typename T,
3311template <
typename Char,
typename OutputIt>
3318template <
typename Char,
typename OutputIt>
3329template <
typename Char,
typename OutputIt,
typename T,
3335 return write_ptr<Char>(out, bit_cast<uintptr_t>(
value), &specs);
3339template <
typename Char,
typename OutputIt,
typename T,
3343 !is_floating_point<T>::value && !std::is_same<T, Char>::value &&
3344 !std::is_same<
const T&,
3350template <
typename Char,
typename OutputIt,
typename T,
3355 using formatter_type =
3357 typename Context::template formatter_type<T>,
3359 auto ctx = Context(out, {}, {});
3360 return formatter_type().format(
value, ctx);
3374 return write<Char>(out,
value);
3378 context format_ctx(out, args, loc);
3379 h.format(parse_ctx, format_ctx);
3380 return format_ctx.out();
3392 template <
typename T>
3409 h.format(parse_ctx, ctx);
3414template <
typename T>
3417 !std::is_same<T, char>::value &&
3418 !std::is_same<T, wchar_t>::value>;
3424 template <
typename T, FMT_ENABLE_IF(is_
integer<T>::value)>
3427 return static_cast<unsigned long long>(
value);
3430 template <
typename T, FMT_ENABLE_IF(!is_
integer<T>::value)>
3432 handler_.on_error(
"width is not integer");
3437 ErrorHandler& handler_;
3444 template <
typename T, FMT_ENABLE_IF(is_
integer<T>::value)>
3447 return static_cast<unsigned long long>(
value);
3450 template <
typename T, FMT_ENABLE_IF(!is_
integer<T>::value)>
3452 handler_.on_error(
"precision is not integer");
3457 ErrorHandler& handler_;
3460template <
template <
typename>
class Handler,
typename FormatArg,
3461 typename ErrorHandler>
3464 if (
value >
to_unsigned(max_value<int>())) eh.on_error(
"number is too big");
3465 return static_cast<int>(
value);
3468template <
typename Context,
typename ID>
3470 typename Context::format_arg {
3471 auto arg = ctx.arg(
id);
3472 if (!
arg) ctx.on_error(
"argument not found");
3503 :
specs_setter<Char>(specs), parse_context_(parse_ctx), context_(ctx) {}
3506 this->specs_.width = get_dynamic_spec<width_checker>(
3511 this->specs_.precision = get_dynamic_spec<precision_checker>(
3518template <
template <
typename>
class Handler,
typename Context>
3526 value = detail::get_dynamic_spec<Handler>(ctx.arg(ref.
val.
index),
3527 ctx.error_handler());
3530 value = detail::get_dynamic_spec<Handler>(ctx.arg(ref.
val.
name),
3531 ctx.error_handler());
3536#if FMT_USE_USER_DEFINED_LITERALS
3537template <
typename Char>
struct udl_formatter {
3540 template <
typename... T>
3541 auto operator()(T&&... args)
const -> std::basic_string<Char> {
3546# if FMT_USE_NONTYPE_TEMPLATE_ARGS
3547template <
typename T,
typename Char,
size_t N,
3548 fmt::detail_exported::fixed_string<Char, N> Str>
3549struct statically_named_arg :
view {
3550 static constexpr auto name = Str.data;
3553 statically_named_arg(
const T& v) :
value(v) {}
3556template <
typename T,
typename Char,
size_t N,
3557 fmt::detail_exported::fixed_string<Char, N> Str>
3558struct is_named_arg<statically_named_arg<T, Char, N, Str>> : std::true_type {};
3560template <
typename T,
typename Char,
size_t N,
3561 fmt::detail_exported::fixed_string<Char, N> Str>
3563 : std::true_type {};
3565template <
typename Char,
size_t N,
3566 fmt::detail_exported::fixed_string<Char, N> Str>
3568 template <
typename T>
auto operator=(T&&
value)
const {
3569 return statically_named_arg<T, Char, N, Str>(std::forward<T>(
value));
3573template <
typename Char>
struct udl_arg {
3577 return {str, std::forward<T>(
value)};
3583template <
typename Locale,
typename Char>
3586 -> std::basic_string<Char> {
3598 const char* message)
noexcept;
3621template <
typename... T>
3644 const char* message)
noexcept;
3656 mutable char buffer_[buffer_size];
3659 template <
typename UInt>
auto format_unsigned(UInt
value) ->
char* {
3660 auto n =
static_cast<detail::uint32_or_64_or_128_t<UInt>
>(
value);
3664 template <
typename Int>
auto format_signed(Int
value) ->
char* {
3665 auto abs_value =
static_cast<detail::uint32_or_64_or_128_t<Int>
>(
value);
3666 bool negative =
value < 0;
3667 if (negative) abs_value = 0 - abs_value;
3668 auto begin = format_unsigned(abs_value);
3669 if (negative) *--
begin =
'-';
3680 : str_(format_unsigned(
value)) {}
3691 auto data() const -> const
char* {
return str_; }
3698 buffer_[buffer_size - 1] =
'\0';
3707 auto str() const ->
std::
string {
return std::string(str_,
size()); }
3710template <
typename T,
typename Char>
3711template <
typename FormatContext>
3715 detail::type::custom_type>>
::format(
const T& val,
3717 const ->
decltype(ctx.out()) {
3718 if (specs_.width_ref.kind != detail::arg_id_kind::none ||
3719 specs_.precision_ref.kind != detail::arg_id_kind::none) {
3720 auto specs = specs_;
3721 detail::handle_dynamic_spec<detail::width_checker>(specs.
width,
3722 specs.width_ref, ctx);
3723 detail::handle_dynamic_spec<detail::precision_checker>(
3724 specs.
precision, specs.precision_ref, ctx);
3725 return detail::write<Char>(ctx.out(), val, specs, ctx.locale());
3727 return detail::write<Char>(ctx.out(), val, specs_, ctx.locale());
3730template <
typename Char>
3732 template <
typename FormatContext>
3733 auto format(
void* val, FormatContext& ctx)
const ->
decltype(ctx.out()) {
3738template <
typename Char,
size_t N>
3740 template <
typename FormatContext>
3742 ->
decltype(ctx.out()) {
3761 detail::dynamic_format_specs<Char> specs_;
3762 const Char* format_str_;
3764 struct null_handler : detail::error_handler {
3770 template <
typename Context>
void handle_specs(Context& ctx) {
3771 detail::handle_dynamic_spec<detail::width_checker>(specs_.width,
3772 specs_.width_ref, ctx);
3773 detail::handle_dynamic_spec<detail::precision_checker>(
3774 specs_.precision, specs_.precision_ref, ctx);
3778 template <
typename ParseContext>
3780 format_str_ = ctx.begin();
3782 detail::dynamic_specs_handler<ParseContext> handler(specs_, ctx);
3786 template <
typename T,
typename FormatContext>
3787 auto format(
const T& val, FormatContext& ctx) ->
decltype(ctx.out()) {
3789 detail::specs_checker<null_handler> checker(
3790 null_handler(), detail::mapped_type_constant<T, FormatContext>::value);
3791 checker.on_align(specs_.align);
3792 if (specs_.sign != sign::none) checker.on_sign(specs_.sign);
3793 if (specs_.alt) checker.on_hash();
3794 if (specs_.precision >= 0) checker.end_precision();
3795 return detail::write<Char>(ctx.out(), val, specs_, ctx.locale());
3808template <
typename T>
auto ptr(T p) ->
const void* {
3809 static_assert(std::is_pointer<T>::value,
"");
3810 return detail::bit_cast<const void*>(p);
3812template <
typename T>
auto ptr(
const std::unique_ptr<T>& p) ->
const void* {
3815template <
typename T>
auto ptr(
const std::shared_ptr<T>& p) ->
const void* {
3829template <
typename Enum>
3835template <
typename Enum, FMT_ENABLE_IF(std::is_enum<Enum>::value)>
3852 detail::dynamic_format_specs<char> specs_;
3855 template <
typename ParseContext>
3857 using handler_type = detail::dynamic_specs_handler<ParseContext>;
3858 detail::specs_checker<handler_type> handler(handler_type(specs_, ctx),
3859 detail::type::string_type);
3865 template <
typename FormatContext>
3867 detail::handle_dynamic_spec<detail::width_checker>(specs_.width,
3868 specs_.width_ref, ctx);
3869 detail::handle_dynamic_spec<detail::precision_checker>(
3870 specs_.precision, specs_.precision_ref, ctx);
3895 detail::dynamic_format_specs<char> specs_;
3898 template <
typename ParseContext>
3900 using handler_type = detail::dynamic_specs_handler<ParseContext>;
3901 detail::specs_checker<handler_type> handler(handler_type(specs_, ctx),
3902 detail::type::int_type);
3908 template <
typename FormatContext>
3910 ->
decltype(ctx.out()) {
3911 detail::handle_dynamic_spec<detail::width_checker>(specs_.width,
3912 specs_.width_ref, ctx);
3913 detail::handle_dynamic_spec<detail::precision_checker>(
3914 specs_.precision, specs_.precision_ref, ctx);
3916 ctx.out(),
static_cast<detail::uint64_or_128_t<T>
>(t.value), 0, specs_,
3917 detail::digit_grouping<char>({
"\3",
','}));
3921template <
typename It,
typename Sentinel,
typename Char =
char>
3931template <
typename It,
typename Sentinel,
typename Char>
3935#ifdef __cpp_lib_ranges
3936 std::iter_value_t<It>;
3938 typename std::iterator_traits<It>::value_type;
3941 using mapper = detail::arg_mapper<context>;
3943 template <
typename T, FMT_ENABLE_IF(has_formatter<T, context>::value)>
3944 static auto map(
const T&
value) ->
const T& {
3947 template <
typename T, FMT_ENABLE_IF(!has_formatter<T, context>::value)>
3948 static auto map(
const T&
value) ->
decltype(mapper().map(
value)) {
3949 return mapper().map(
value);
3952 using formatter_type =
3955 std::declval<const value_type&>()))>,
3957 detail::fallback_formatter<value_type, Char>>;
3959 formatter_type value_formatter_;
3962 template <
typename ParseContext>
3964 return value_formatter_.parse(ctx);
3967 template <
typename FormatContext>
3969 FormatContext& ctx)
const ->
decltype(ctx.out()) {
3970 auto it =
value.begin;
3971 auto out = ctx.out();
3972 if (it !=
value.end) {
3973 out = value_formatter_.format(
map(*it), ctx);
3975 while (it !=
value.end) {
3976 out = detail::copy_str<Char>(
value.sep.begin(),
value.sep.end(), out);
3977 ctx.advance_to(out);
3978 out = value_formatter_.format(
map(*it), ctx);
3990template <
typename It,
typename Sentinel>
4011template <
typename Range>
4028template <
typename T, FMT_ENABLE_IF(!std::is_
integral<T>::value)>
4030 auto result = std::string();
4031 detail::write<char>(std::back_inserter(
result),
value);
4035template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
4039 constexpr int max_size = detail::digits10<T>() + 2;
4040 char buffer[max_size > 5 ?
static_cast<unsigned>(max_size) : 5];
4045template <
typename Char,
size_t SIZE>
4047 -> std::basic_string<Char> {
4048 auto size = buf.size();
4050 return std::basic_string<Char>(buf.data(),
size);
4055template <
typename Char>
4062 using detail::arg_formatter;
4064 using detail::custom_formatter;
4065 using detail::default_arg_formatter;
4067 using detail::locale_ref;
4069 using detail::specs_checker;
4070 using detail::specs_handler;
4076 auto arg = args.get(0);
4089 : parse_context(str), context(p_out, p_args, p_loc) {}
4091 void on_text(
const Char*
begin,
const Char*
end) {
4103 int arg_id = context.
arg_id(
id);
4104 if (arg_id < 0) on_error(
"argument not found");
4108 FMT_INLINE void on_replacement_field(
int id,
const Char*) {
4116 auto on_format_specs(
int id,
const Char*
begin,
const Char*
end)
4123 return parse_context.
begin();
4130 on_error(
"missing '}' in format string");
4136 detail::parse_format_string<false>(fmt, format_handler(out, fmt, args, loc));
4139#ifndef FMT_HEADER_ONLY
4150#if FMT_USE_USER_DEFINED_LITERALS
4162# if FMT_USE_NONTYPE_TEMPLATE_ARGS
4163template <detail_exported::fixed_
string Str>
constexpr auto operator""_a() {
4165 return detail::udl_arg<
char_t,
sizeof(Str.data) /
sizeof(
char_t), Str>();
4168constexpr auto operator"" _a(
const char* s,
size_t) -> detail::udl_arg<char> {
4175template <
typename Locale, FMT_ENABLE_IF(detail::is_locale<Locale>::value)>
4181template <
typename Locale,
typename... T,
4188template <
typename OutputIt,
typename Locale,
4189 FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value&&
4190 detail::is_locale<Locale>::value)>
4194 auto&& buf = get_buffer<char>(out);
4199template <
typename OutputIt,
typename Locale,
typename... T,
4200 FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value&&
4201 detail::is_locale<Locale>::value)>
4210#ifdef FMT_HEADER_ONLY
4211# define FMT_FUNC inline
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
Definition: ArrayCwiseUnaryOps.h:66
EIGEN_DEVICE_FUNC const SquareReturnType square() const
Definition: ArrayCwiseUnaryOps.h:425
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typenameEIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typenameEIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
Definition: IndexedViewMethods.h:73
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
Definition: ThirdPartyNotices.txt:131
FMT_CONSTEXPR auto locale() -> detail::locale_ref
Definition: core.h:1838
FMT_CONSTEXPR auto out() -> iterator
Definition: core.h:1831
FMT_CONSTEXPR auto arg_id(basic_string_view< char_type > name) -> int
Definition: core.h:1820
void on_error(const char *message)
Definition: core.h:1828
FMT_CONSTEXPR auto error_handler() -> detail::error_handler
Definition: core.h:1827
auto args() const -> const basic_format_args< basic_format_context > &
Definition: core.h:1823
void advance_to(iterator it)
Definition: core.h:1834
\rst Parsing context consisting of a format string range being parsed and an argument counter for aut...
Definition: core.h:654
FMT_CONSTEXPR void check_arg_id(int id)
Reports an error if using the automatic argument indexing; otherwise switches to the manual indexing.
Definition: core.h:706
FMT_CONSTEXPR auto next_arg_id() -> int
Reports an error if using the manual argument indexing; otherwise returns the next argument index and...
Definition: core.h:692
FMT_CONSTEXPR void advance_to(iterator it)
Advances the begin iterator to it.
Definition: core.h:684
constexpr auto begin() const noexcept -> iterator
Returns an iterator to the beginning of the format string range being parsed.
Definition: core.h:674
\rst A dynamically growing memory buffer for trivially copyable/constructible types with the first SI...
Definition: format.h:819
const T & const_reference
Definition: format.h:837
FMT_CONSTEXPR20 void resize(size_t count)
Resizes the buffer to contain count elements.
Definition: format.h:897
FMT_CONSTEXPR20 ~basic_memory_buffer()
Definition: format.h:845
auto operator=(basic_memory_buffer &&other) noexcept -> basic_memory_buffer &
\rst Moves the content of the other basic_memory_buffer object to this one.
Definition: format.h:883
void reserve(size_t new_capacity)
Increases the buffer capacity to new_capacity.
Definition: format.h:900
auto get_allocator() const -> Allocator
Definition: format.h:891
FMT_CONSTEXPR20 void grow(size_t size) override
Definition: format.h:911
void append(const ContiguousRange &range)
Definition: format.h:905
FMT_CONSTEXPR20 basic_memory_buffer(basic_memory_buffer &&other) noexcept
\rst Constructs a :class:fmt::basic_memory_buffer object moving the content of the other object to it...
Definition: format.h:874
T value_type
Definition: format.h:836
An implementation of std::basic_string_view for pre-C++17.
Definition: core.h:430
constexpr auto end() const noexcept -> iterator
Definition: core.h:478
constexpr auto size() const noexcept -> size_t
Returns the string size.
Definition: core.h:475
constexpr auto data() const noexcept -> const Char *
Returns a pointer to the string data.
Definition: core.h:472
constexpr auto begin() const noexcept -> iterator
Definition: core.h:477
Definition: format.h:2707
friend FMT_CONSTEXPR20 int compare(const bigint &lhs, const bigint &rhs)
Definition: format.h:2841
FMT_CONSTEXPR20 void assign_pow10(int exp)
Definition: format.h:2884
FMT_CONSTEXPR20 bigint()
Definition: format.h:2797
bigint(const bigint &)=delete
FMT_CONSTEXPR20 void assign(const bigint &other)
Definition: format.h:2803
FMT_CONSTEXPR20 void square()
Definition: format.h:2903
friend FMT_CONSTEXPR20 int add_compare(const bigint &lhs1, const bigint &lhs2, const bigint &rhs)
Definition: format.h:2858
FMT_NOINLINE FMT_CONSTEXPR20 bigint & operator<<=(int shift)
Definition: format.h:2820
FMT_CONSTEXPR20 int divmod_assign(const bigint &divisor)
Definition: format.h:2946
bigint(uint64_t n)
Definition: format.h:2798
FMT_CONSTEXPR20 bigint & operator*=(Int value)
Definition: format.h:2835
FMT_CONSTEXPR20 int num_bigits() const
Definition: format.h:2816
void operator=(const bigint &)=delete
FMT_CONSTEXPR20 void align(const bigint &other)
Definition: format.h:2933
FMT_CONSTEXPR20 void operator=(Int n)
Definition: format.h:2811
void append(const U *begin, const U *end)
Appends data to the end of the buffer.
auto end() noexcept -> T *
Definition: core.h:896
FMT_CONSTEXPR20 void push_back(const T &value)
Definition: core.h:931
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data.
Definition: core.h:908
FMT_CONSTEXPR20 void try_resize(size_t count)
Definition: core.h:918
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition: core.h:902
Definition: format.h:3841
bytes(string_view data)
Definition: format.h:3847
Definition: format.h:2138
std::ptrdiff_t difference_type
Definition: format.h:2144
void pointer
Definition: format.h:2145
FMT_CONSTEXPR value_type operator*() const
Definition: format.h:2173
FMT_CONSTEXPR size_t count() const
Definition: format.h:2155
FMT_CONSTEXPR friend counting_iterator operator+(counting_iterator it, difference_type n)
Definition: format.h:2167
std::output_iterator_tag iterator_category
Definition: format.h:2143
FMT_CONSTEXPR counting_iterator & operator++()
Definition: format.h:2157
FMT_UNCHECKED_ITERATOR(counting_iterator)
void reference
Definition: format.h:2146
FMT_CONSTEXPR counting_iterator operator++(int)
Definition: format.h:2161
FMT_CONSTEXPR counting_iterator()
Definition: format.h:2153
FMT_CONSTEXPR auto operator>>=(int shift) -> uint128_fallback &
Definition: format.h:390
constexpr uint64_t low() const noexcept
Definition: format.h:333
friend uint128_fallback umul128(uint64_t x, uint64_t y) noexcept
Definition: format-inl.h:145
constexpr uint128_fallback(uint64_t hi, uint64_t lo)
Definition: format.h:329
FMT_CONSTEXPR auto operator>>(int shift) const -> uint128_fallback
Definition: format.h:380
friend constexpr auto operator==(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition: format.h:340
friend auto operator-(const uint128_fallback &lhs, uint64_t rhs) -> uint128_fallback
Definition: format.h:376
friend constexpr auto operator|(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition: format.h:352
friend auto operator*(const uint128_fallback &lhs, uint32_t rhs) -> uint128_fallback
Definition: format.h:368
FMT_CONSTEXPR auto operator<<(int shift) const -> uint128_fallback
Definition: format.h:385
FMT_CONSTEXPR20 uint128_fallback & operator+=(uint64_t n) noexcept
Definition: format.h:401
friend constexpr auto operator!=(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition: format.h:344
friend auto operator+(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition: format.h:362
friend constexpr auto operator>(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition: format.h:348
constexpr uint128_fallback(uint64_t value=0)
Definition: format.h:330
FMT_CONSTEXPR void operator+=(uint128_fallback n)
Definition: format.h:393
friend constexpr auto operator&(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition: format.h:357
constexpr uint64_t high() const noexcept
Definition: format.h:332
Definition: format.h:1931
Out apply(Out out, basic_string_view< C > digits) const
Definition: format.h:1972
digit_grouping(thousands_sep_result< Char > sep)
Definition: format.h:1959
digit_grouping(locale_ref loc, bool localized=true)
Definition: format.h:1953
int count_separators(int num_digits) const
Definition: format.h:1963
Char separator() const
Definition: format.h:1961
Definition: format.h:2465
constexpr fallback_digit_grouping(locale_ref, bool)
Definition: format.h:2467
constexpr Char separator() const
Definition: format.h:2469
constexpr int count_separators(int) const
Definition: format.h:2471
constexpr Out apply(Out out, basic_string_view< C >) const
Definition: format.h:2474
Definition: format.h:3440
FMT_CONSTEXPR auto operator()(T) -> unsigned long long
Definition: format.h:3451
FMT_CONSTEXPR precision_checker(ErrorHandler &eh)
Definition: format.h:3442
FMT_CONSTEXPR auto operator()(T value) -> unsigned long long
Definition: format.h:3445
Definition: format.h:3477
FMT_CONSTEXPR void on_dynamic_width(Id arg_id)
Definition: format.h:3505
void on_error(const char *message)
Definition: format.h:3515
FMT_CONSTEXPR specs_handler(basic_format_specs< Char > &specs, basic_format_parse_context< Char > &parse_ctx, buffer_context< Char > &ctx)
Definition: format.h:3500
FMT_CONSTEXPR void on_dynamic_precision(Id arg_id)
Definition: format.h:3510
Definition: format.h:1274
auto str() const -> std::wstring
Definition: format.h:1283
auto size() const -> size_t
Definition: format.h:1281
auto c_str() const -> const wchar_t *
Definition: format.h:1282
Definition: format.h:3420
FMT_CONSTEXPR auto operator()(T) -> unsigned long long
Definition: format.h:3431
FMT_CONSTEXPR auto operator()(T value) -> unsigned long long
Definition: format.h:3425
FMT_CONSTEXPR width_checker(ErrorHandler &eh)
Definition: format.h:3422
typename std::enable_if< B, T >::type enable_if_t
Definition: core.h:298
constexpr FMT_INLINE auto const_check(T value) -> T
Definition: core.h:356
#define FMT_ASSERT(condition, message)
Definition: core.h:369
FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(Visitor &&vis, const basic_format_arg< Context > &arg) -> decltype(vis(0))
\rst Visits an argument dispatching to the appropriate visit method based on the argument type.
Definition: core.h:1623
FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(const Char *begin, const Char *end, SpecHandler &&handler) -> const Char *
Definition: core.h:2561
std::integral_constant< bool, B > bool_constant
Definition: core.h:301
#define FMT_USE_LONG_DOUBLE
Definition: core.h:192
basic_string_view< char > string_view
Definition: core.h:520
FMT_CONSTEXPR auto code_point_length_impl(char c) -> int
Definition: core.h:2300
align::type align_t
Definition: core.h:2077
FMT_CONSTEXPR auto check_char_specs(const basic_format_specs< Char > &specs, ErrorHandler &&eh={}) -> bool
Definition: core.h:2758
#define FMT_FALLTHROUGH
Definition: core.h:174
#define FMT_NODISCARD
Definition: core.h:181
typename std::remove_reference< T >::type remove_reference_t
Definition: core.h:303
uint128_opt
Definition: core.h:400
typename detail::char_t_impl< S >::type char_t
String's character type.
Definition: core.h:644
#define FMT_END_DETAIL_NAMESPACE
Definition: core.h:227
#define FMT_USE_FLOAT
Definition: core.h:186
FMT_CONSTEXPR void check_string_type_spec(presentation_type type, ErrorHandler &&eh={})
Definition: core.h:2844
constexpr auto count() -> size_t
Definition: core.h:1204
#define FMT_CLASS_API
Definition: core.h:238
int128_opt
Definition: core.h:399
constexpr auto make_format_args(Args &&... args) -> format_arg_store< Context, remove_cvref_t< Args >... >
\rst Constructs a ~fmtformat_arg_store object that contains references to arguments and can be implic...
Definition: core.h:1916
#define FMT_CONSTEXPR
Definition: core.h:106
FMT_CONSTEXPR void check_pointer_type_spec(presentation_type type, ErrorHandler &&eh)
Definition: core.h:2852
type
Definition: core.h:575
#define FMT_BEGIN_NAMESPACE
Definition: core.h:214
#define FMT_BEGIN_DETAIL_NAMESPACE
Definition: core.h:226
#define FMT_API
Definition: core.h:246
FMT_BEGIN_DETAIL_NAMESPACE FMT_CONSTEXPR void ignore_unused(const T &...)
Definition: core.h:343
constexpr FMT_INLINE auto is_constant_evaluated(bool default_value=false) noexcept -> bool
Definition: core.h:345
#define FMT_BUFFER_CONTEXT(Char)
Definition: core.h:1847
constexpr auto is_utf8() -> bool
Definition: core.h:415
conditional_t< std::is_same< T, char >::value, appender, std::back_insert_iterator< buffer< T > > > buffer_appender
Definition: core.h:1106
FMT_CONSTEXPR auto check_cstring_type_spec(presentation_type type, ErrorHandler &&eh={}) -> bool
Definition: core.h:2834
FMT_MSC_WARNING(suppress :4566) const expr unsigned char micro[]
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
Definition: core.h:1110
#define FMT_ENABLE_IF(...)
Definition: core.h:335
#define FMT_CONSTEXPR_CHAR_TRAITS
Definition: core.h:130
#define FMT_INLINE
Definition: core.h:199
auto get_iterator(Buffer &buf) -> decltype(buf.out())
Definition: core.h:1115
FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned< Int >::type
Definition: core.h:407
FMT_NORETURN FMT_API void throw_format_error(const char *message)
FMT_INLINE auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition: core.h:536
typename type_identity< T >::type type_identity_t
Definition: core.h:309
typename std::conditional< B, T, F >::type conditional_t
Definition: core.h:300
#define FMT_CONSTEXPR20
Definition: core.h:114
auto get_container(std::back_insert_iterator< Container > it) -> Container &
Definition: core.h:829
sign::type sign_t
Definition: core.h:2081
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
Definition: core.h:307
#define FMT_USE_DOUBLE
Definition: core.h:189
typename std::underlying_type< T >::type underlying_t
Definition: core.h:311
#define FMT_END_NAMESPACE
Definition: core.h:217
#define FMT_MODULE_EXPORT_END
Definition: core.h:225
FMT_CONSTEXPR auto parse_float_type_spec(const basic_format_specs< Char > &specs, ErrorHandler &&eh={}) -> float_specs
Definition: core.h:2790
UnitType ceil(const UnitType x) noexcept
Round up value.
Definition: math.h:528
constexpr common_t< T1, T2 > max(const T1 x, const T2 y) noexcept
Compile-time pairwise maximum function.
Definition: max.hpp:35
std::size_t UIntPtr
Definition: Meta.h:92
const Scalar & y
Definition: MathFunctions.h:821
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
::uint64_t uint64_t
Definition: Meta.h:58
::int16_t int16_t
Definition: Meta.h:55
::uint32_t uint32_t
Definition: Meta.h:56
::int64_t int64_t
Definition: Meta.h:59
::uint8_t uint8_t
Definition: Meta.h:52
static EIGEN_DEPRECATED const end_t end
Definition: IndexedViewHelper.h:181
uint32_t divisor
Definition: format-inl.h:236
constexpr auto compile_string_to_view(detail::std_string_view< Char > s) -> basic_string_view< Char >
Definition: format.h:981
constexpr auto base_iterator(Iterator, Iterator it) -> Iterator
Definition: format.h:553
FMT_CONSTEXPR20 auto bit_cast(const From &from) -> To
Definition: format.h:297
decltype(std::end(std::declval< T & >())) sentinel_t
Definition: format.h:476
FMT_INLINE void assume(bool condition)
Definition: format.h:466
constexpr auto num_bits() -> int
Definition: format.h:440
auto write(OutputIt out, const std::tm &time, const std::locale &loc, char format, char modifier=0) -> OutputIt
Definition: chrono.h:426
auto is_big_endian() -> bool
Definition: format.h:307
auto compute_width(basic_string_view< Char > s) -> size_t
Definition: format.h:675
constexpr auto num_bits< uint128_t >() -> int
Definition: format.h:445
auto base_iterator(std::back_insert_iterator< Container > &it, checked_ptr< typename Container::value_type >) -> std::back_insert_iterator< Container >
Definition: format.h:546
auto compute_width(basic_string_view< char8_type > s) -> size_t
Definition: format.h:713
std::is_same< T, float128 > is_float128
Definition: format.h:752
constexpr auto max_value() -> T
Definition: format.h:437
void float128
Definition: format.h:750
decltype(std::begin(std::declval< T & >())) iterator_t
Definition: format.h:475
FMT_FUNC void print(std::FILE *f, string_view text)
Definition: format-inl.h:1499
constexpr uint32_t invalid_code_point
Definition: format.h:639
FMT_CONSTEXPR20 auto fill_n(T *out, Size count, char value) -> T *
Definition: format.h:566
constexpr auto to_pointer(OutputIt, size_t) -> T *
Definition: format.h:534
OutputIterator copy(const RangeT &range, OutputIterator out)
Definition: ranges.h:26
constexpr auto reserve(Iterator &it, size_t) -> Iterator &
Definition: format.h:525
bool_constant< std::is_floating_point< T >::value||is_float128< T >::value > is_floating_point
Definition: format.h:756
remove_reference_t< decltype(reserve(std::declval< OutputIt & >(), 0))> reserve_iterator
Definition: format.h:531
auto reserve(std::back_insert_iterator< Container > it, size_t n) -> checked_ptr< typename Container::value_type >
Definition: format.h:509
constexpr auto num_bits< int128_opt >() -> int
Definition: format.h:444
conditional_t< FMT_USE_INT128, uint128_opt, uint128_fallback > uint128_t
Definition: format.h:427
FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T &value) -> OutputIt
Definition: format.h:560
constexpr auto make_checked(T *p, size_t) -> T *
Definition: format.h:497
FMT_CONSTEXPR auto utf8_decode(const char *s, uint32_t *c, int *e) -> const char *
Definition: format.h:603
FMT_CONSTEXPR void abort_fuzzing_if(bool condition)
Definition: format.h:245
auto code_point_index(basic_string_view< Char > s, size_t n) -> size_t
Definition: format.h:719
auto get_data(std::basic_string< Char > &s) -> Char *
Definition: format.h:480
FMT_CONSTEXPR void for_each_codepoint(string_view s, F f)
Definition: format.h:644
uint128_t uintptr_t
Definition: format.h:432
T * checked_ptr
Definition: format.h:496
auto code_point_index(basic_string_view< char8_type > s, size_t n) -> size_t
Definition: format.h:734
FMT_CONSTEXPR FMT_NOINLINE auto copy_str_noinline(InputIt begin, InputIt end, OutputIt out) -> OutputIt
Definition: format.h:581
char8_type
Definition: format.h:577
Definition: format.h:2555
result
Definition: format.h:2556
@ done
Definition: format.h:2558
@ error
Definition: format.h:2559
@ more
Definition: format.h:2557
Definition: format.h:1286
FMT_API auto to_decimal(T x) noexcept -> decimal_fp< T >
Definition: format.h:3834
constexpr auto format_as(Enum e) noexcept -> underlying_t< Enum >
Definition: format.h:3836
GHC_FS_API directory_iterator begin(directory_iterator iter) noexcept
Definition: filesystem.hpp:5746
Definition: StdDeque.h:50
static constexpr const unit_t< compound_unit< energy::joule, time::seconds > > h(6.626070040e-34)
Planck constant.
static constexpr const unit_t< compound_unit< charge::coulomb, inverse< substance::mol > > > F(N_A *e)
Faraday constant.
static constexpr const charge::coulomb_t e(1.6021766208e-19)
elementary charge.
static constexpr const velocity::meters_per_second_t c(299792458.0)
Speed of light in vacuum.
bits
Definition: data.h:44
flags
Definition: http_parser.h:206
FMT_CONSTEXPR FMT_INLINE auto map(signed char val) -> int
Definition: core.h:1348
arg_id_kind kind
Definition: core.h:2175
Definition: format.h:1478
static constexpr uint64_t pow10_significands[87]
Definition: format.h:1481
static constexpr uint64_t power_of_10_64[20]
Definition: format.h:1532
static constexpr int16_t pow10_exponents[87]
Definition: format.h:1519
Definition: format.h:1390
int e
Definition: format.h:1392
FMT_CONSTEXPR auto assign(Float n) -> bool
Definition: format.h:1405
constexpr basic_fp()
Definition: format.h:1397
F f
Definition: format.h:1391
FMT_CONSTEXPR basic_fp(Float n)
Definition: format.h:1401
static constexpr const int num_significand_bits
Definition: format.h:1394
constexpr basic_fp(uint64_t f_val, int e_val)
Definition: format.h:1398
Definition: format.h:2256
int significand_size
Definition: format.h:2258
int exponent
Definition: format.h:2259
const char * significand
Definition: format.h:2257
Definition: format.h:2149
FMT_CONSTEXPR void operator=(const T &)
Definition: format.h:2150
Definition: format.h:1544
static constexpr CharT value[sizeof...(C)]
Definition: format.h:253
Definition: format.h:1330
int exponent
Definition: format.h:1333
typename float_info< T >::carrier_uint significand_type
Definition: format.h:1331
significand_type significand
Definition: format.h:1332
detail::uint128_t carrier_uint
Definition: format.h:1327
detail::uint128_t carrier_uint
Definition: format.h:1320
uint64_t carrier_uint
Definition: format.h:1304
uint32_t carrier_uint
Definition: format.h:1292
Definition: format.h:1289
FMT_NORETURN void on_error(const char *message)
Definition: core.h:637
Definition: format.h:1710
const Char * end
Definition: format.h:1712
uint32_t cp
Definition: format.h:1713
const Char * begin
Definition: format.h:1711
float_format format
Definition: core.h:2781
int precision
Definition: core.h:2780
sign_t sign
Definition: core.h:2782
bool binary32
Definition: core.h:2785
Definition: format.h:2563
bool fixed
Definition: format.h:2568
FMT_CONSTEXPR digits::result on_digit(char digit, uint64_t divisor, uint64_t remainder, uint64_t error, bool integral)
Definition: format.h:2570
int exp10
Definition: format.h:2567
int size
Definition: format.h:2565
int precision
Definition: format.h:2566
char * buf
Definition: format.h:2564
Definition: format.h:3876
T value
Definition: format.h:3876
Definition: format.h:2498
Definition: format.h:3922
It begin
Definition: format.h:3923
join_view(It b, Sentinel e, basic_string_view< Char > s)
Definition: format.h:3927
Sentinel end
Definition: format.h:3924
basic_string_view< Char > sep
Definition: format.h:3925
Definition: format.h:1160
std::string grouping
Definition: format.h:1161
Char thousands_sep
Definition: format.h:1162
Definition: format.h:2027
UInt abs_value
Definition: format.h:2028
unsigned prefix
Definition: format.h:2029
Definition: format.h:1883
FMT_CONSTEXPR write_int_data(int num_digits, unsigned prefix, const basic_format_specs< Char > &specs)
Definition: format.h:1887
size_t padding
Definition: format.h:1885
size_t size
Definition: format.h:1884
int index
Definition: core.h:2180
basic_string_view< Char > name
Definition: core.h:2181