36#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
37# define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
38# define FMT_REMOVE_TRANSITIVE_INCLUDES
50# if defined(__GLIBCXX__) && !defined(_GLIBCXX_USE_DUAL_ABI)
56# include <system_error>
59# if FMT_HAS_INCLUDE(<bit>) && FMT_CPLUSPLUS > 201703L
64# if FMT_HAS_INCLUDE(<string_view>) && \
65 (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
66# include <string_view>
67# define FMT_USE_STRING_VIEW
75#if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS)
77#elif defined(__NVCOMPILER)
78# define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
79#elif FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L
80# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
81#elif defined(__cpp_nontype_template_args) && \
82 __cpp_nontype_template_args >= 201911L
83# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
84#elif FMT_CLANG_VERSION >= 1200 && FMT_CPLUSPLUS >= 202002L
85# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
87# define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
90#if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L
91# define FMT_INLINE_VARIABLE inline
93# define FMT_INLINE_VARIABLE
99#elif defined(__GXX_RTTI) || FMT_HAS_FEATURE(cxx_rtti) || defined(_CPPRTTI) || \
100 defined(__INTEL_RTTI__) || defined(__RTTI)
102# define FMT_USE_RTTI 1
104# define FMT_USE_RTTI 0
108#if defined(FMT_LIB_EXPORT) || defined(FMT_SHARED)
109# define FMT_SO_VISIBILITY(value) FMT_VISIBILITY(value)
111# define FMT_SO_VISIBILITY(value)
114#if FMT_GCC_VERSION || FMT_CLANG_VERSION
115# define FMT_NOINLINE __attribute__((noinline))
125 decltype(
static_cast<int*
>(
nullptr) -
static_cast<int*
>(
nullptr));
132# if FMT_USE_EXCEPTIONS
133# if FMT_MSC_VERSION || defined(__NVCC__)
136template <
typename Exception>
inline void do_throw(
const Exception& x) {
139 volatile bool b =
true;
144# define FMT_THROW(x) detail::do_throw(x)
146# define FMT_THROW(x) throw x
149# define FMT_THROW(x) \
150 ::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what())
154#ifdef FMT_NO_UNIQUE_ADDRESS
156#elif FMT_CPLUSPLUS < 202002L
158#elif FMT_HAS_CPP_ATTRIBUTE(no_unique_address)
159# define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]]
161#elif FMT_MSC_VERSION >= 1929 && !FMT_CLANG_VERSION
162# define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
164#ifndef FMT_NO_UNIQUE_ADDRESS
165# define FMT_NO_UNIQUE_ADDRESS
172#if !defined(FMT_REDUCE_INT_INSTANTIATIONS)
173# define FMT_REDUCE_INT_INSTANTIATIONS 0
178template <
typename Char,
typename Traits,
typename Allocator>
187# if FMT_HAS_BUILTIN(__builtin_clz) || FMT_GCC_VERSION || FMT_ICC_VERSION
188# define FMT_BUILTIN_CLZ(n) __builtin_clz(n)
190# if FMT_HAS_BUILTIN(__builtin_clzll) || FMT_GCC_VERSION || FMT_ICC_VERSION
191# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
198#if FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL)
201# pragma intrinsic(_BitScanReverse)
203# pragma intrinsic(_BitScanReverse64)
207inline auto clz(uint32_t x) ->
int {
211 _BitScanReverse(&r, x);
212 return 31 ^
static_cast<int>(r);
214# define FMT_BUILTIN_CLZ(n) detail::clz(n)
216inline auto clzll(uint64_t x) ->
int {
221 _BitScanReverse64(&r, x);
224 if (_BitScanReverse(&r,
static_cast<uint32_t
>(x >> 32)))
225 return 63 ^
static_cast<int>(r + 32);
227 _BitScanReverse(&r,
static_cast<uint32_t
>(x));
229 return 63 ^
static_cast<int>(r);
231# define FMT_BUILTIN_CLZLL(n) detail::clzll(n)
237 if (condition)
throw std::runtime_error(
"fuzzing limit reached");
241#if defined(FMT_USE_STRING_VIEW)
242template <
typename Char>
using std_string_view = std::basic_string_view<Char>;
248 static constexpr Char
value[
sizeof...(C)] = {C...};
250 return {
value,
sizeof...(C)};
253#if FMT_CPLUSPLUS < 201703L
254template <
typename Char, Char... C>
255constexpr Char string_literal<Char, C...>
::value[
sizeof...(C)];
259template <
typename To,
typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))>
261#ifdef __cpp_lib_bit_cast
266 std::memcpy(
static_cast<void*
>(&to), &
from,
sizeof(to));
273#elif defined(__BIG_ENDIAN__)
275#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
276 return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__;
279 char data[
sizeof(int)];
293 constexpr auto high() const noexcept -> uint64_t {
return hi_; }
294 constexpr auto low() const noexcept -> uint64_t {
return lo_; }
296 template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
297 constexpr explicit operator T()
const {
298 return static_cast<T
>(lo_);
303 return lhs.hi_ == rhs.hi_ && lhs.lo_ == rhs.lo_;
307 return !(lhs == rhs);
311 return lhs.hi_ != rhs.hi_ ? lhs.hi_ > rhs.hi_ : lhs.lo_ > rhs.lo_;
316 return {lhs.hi_ | rhs.hi_, lhs.lo_ | rhs.lo_};
321 return {lhs.hi_ & rhs.hi_, lhs.lo_ & rhs.lo_};
325 return {~n.hi_, ~n.lo_};
337 uint64_t hi = (lhs.lo_ >> 32) * rhs;
338 uint64_t lo = (lhs.lo_ & ~uint32_t()) * rhs;
339 uint64_t new_lo = (hi << 32) + lo;
340 return {(hi >> 32) + (new_lo < lo ? 1 : 0), new_lo};
344 return {lhs.hi_ - (lhs.lo_ < rhs ? 1 : 0), lhs.lo_ - rhs};
347 if (shift == 64)
return {0, hi_};
349 return {hi_ >> shift, (hi_ << (64 - shift)) | (lo_ >> shift)};
352 if (shift == 64)
return {lo_, 0};
354 return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)};
357 return *
this = *
this >> shift;
360 uint64_t new_lo = lo_ + n.lo_;
361 uint64_t new_hi = hi_ + n.hi_ + (new_lo < lo_ ? 1 : 0);
374 hi_ += (lo_ < n ? 1 : 0);
377#if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__)
378 unsigned long long carry;
379 lo_ = __builtin_addcll(lo_, n, 0, &carry);
381#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__)
382 unsigned long long result;
383 auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &result);
386#elif defined(_MSC_VER) && defined(_M_X64)
387 auto carry = _addcarry_u64(0, lo_, n, &lo_);
388 _addcarry_u64(carry, hi_, 0, &hi_);
391 hi_ += (lo_ < n ? 1 : 0);
408 return (std::numeric_limits<T>::max)();
410template <
typename T>
constexpr auto num_bits() ->
int {
411 return std::numeric_limits<T>::digits;
420template <
typename To,
typename From, FMT_ENABLE_IF(sizeof(To) >
sizeof(From))>
422 constexpr auto size =
static_cast<int>(
sizeof(From) /
sizeof(
unsigned short));
424 unsigned short value[
static_cast<unsigned>(size)];
428 for (
int i = 0; i < size; ++i)
431 for (
int i = size - 1; i >= 0; --i)
437template <
typename UInt>
440 constexpr UInt msb_mask =
static_cast<UInt
>(1) << (
num_bits<UInt>() - 1);
441 for (; (n & msb_mask) == 0; n <<= 1) lz++;
446#ifdef FMT_BUILTIN_CLZ
453#ifdef FMT_BUILTIN_CLZLL
461#if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION
462 __builtin_assume(condition);
464 if (!condition) __builtin_unreachable();
470template <
typename OutputIt,
473#if FMT_CLANG_VERSION >= 307 && !FMT_ICC_VERSION
474__attribute__((no_sanitize(
"undefined")))
477reserve(OutputIt it,
size_t n) ->
typename OutputIt::value_type* {
479 size_t size = c.size();
492template <
typename Iterator>
493constexpr auto reserve(Iterator& it,
size_t) -> Iterator& {
497template <
typename OutputIt>
501template <
typename T,
typename OutputIt>
509 auto size = buf.
size();
510 if (buf.
capacity() < size + n)
return nullptr;
512 return buf.
data() + size;
515template <
typename OutputIt,
519 typename OutputIt::container_type::value_type*)
524template <
typename Iterator>
531template <
typename OutputIt,
typename Size,
typename T>
534 for (Size i = 0; i <
count; ++i) *out++ =
value;
537template <
typename T,
typename Size>
544template <
typename OutChar,
typename InputIt,
typename OutputIt>
546 OutputIt out) -> OutputIt {
569 constexpr const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07};
570 constexpr const uint32_t mins[] = {4194304, 0, 128, 2048, 65536};
571 constexpr const int shiftc[] = {0, 18, 12, 6, 0};
572 constexpr const int shifte[] = {0, 6, 4, 2, 0};
574 int len =
"\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\0\0\2\2\2\2\3\3\4"
575 [
static_cast<unsigned char>(*s) >> 3];
579 const char* next = s + len + !len;
581 using uchar =
unsigned char;
585 *c = uint32_t(uchar(s[0]) & masks[len]) << 18;
586 *c |= uint32_t(uchar(s[1]) & 0x3f) << 12;
587 *c |= uint32_t(uchar(s[2]) & 0x3f) << 6;
588 *c |= uint32_t(uchar(s[3]) & 0x3f) << 0;
592 *e = (*c < mins[len]) << 6;
593 *e |= ((*c >> 11) == 0x1b) << 7;
594 *e |= (*c > 0x10FFFF) << 8;
595 *e |= (uchar(s[1]) & 0xc0) >> 2;
596 *e |= (uchar(s[2]) & 0xc0) >> 4;
597 *e |= uchar(s[3]) >> 6;
610 auto decode = [f](
const char* buf_ptr,
const char*
ptr) {
611 auto cp = uint32_t();
616 return result ? (
error ? buf_ptr + 1 : end) :
nullptr;
620 const size_t block_size = 4;
621 if (s.
size() >= block_size) {
622 for (
auto end = p + s.
size() - block_size + 1; p < end;) {
628 if (num_chars_left == 0)
return;
632 char buf[2 * block_size - 1] = {};
634 const char* buf_ptr = buf;
636 auto end = decode(buf_ptr, p);
640 }
while (buf_ptr < buf + num_chars_left);
643template <
typename Char>
650 size_t num_code_points = 0;
652 struct count_code_points {
662 (cp >= 0x2e80 && cp <= 0xa4cf && cp != 0x303f) ||
663 (cp >= 0xac00 && cp <= 0xd7a3) ||
664 (cp >= 0xf900 && cp <= 0xfaff) ||
665 (cp >= 0xfe10 && cp <= 0xfe19) ||
666 (cp >= 0xfe30 && cp <= 0xfe6f) ||
667 (cp >= 0xff00 && cp <= 0xff60) ||
668 (cp >= 0xffe0 && cp <= 0xffe6) ||
669 (cp >= 0x20000 && cp <= 0x2fffd) ||
670 (cp >= 0x30000 && cp <= 0x3fffd) ||
672 (cp >= 0x1f300 && cp <= 0x1f64f) ||
674 (cp >= 0x1f900 && cp <= 0x1f9ff))));
680 return num_code_points;
683template <
typename Char>
685 return min_of(n, s.size());
690 size_t result = s.size();
691 const char* begin = s.begin();
709 std::integral_constant<bool, std::numeric_limits<T>::is_signed ||
710 std::is_same<T, int128_opt>::value>;
715 !std::is_same<T, char>::value &&
716 !std::is_same<T, wchar_t>::value>;
718#if defined(FMT_USE_FLOAT128)
720#elif FMT_CLANG_VERSION && FMT_HAS_INCLUDE(<quadmath.h>)
721# define FMT_USE_FLOAT128 1
722#elif FMT_GCC_VERSION && defined(_GLIBCXX_USE_FLOAT128) && \
723 !defined(__STRICT_ANSI__)
724# define FMT_USE_FLOAT128 1
726# define FMT_USE_FLOAT128 0
729using float128 = __float128;
734template <
typename T>
using is_float128 = std::is_same<T, float128>;
740template <typename T, bool = std::is_floating_point<T>::value>
741struct is_fast_float :
bool_constant<std::numeric_limits<T>::is_iec559 &&
742 sizeof(T) <= sizeof(double)> {};
743template <typename T> struct is_fast_float<T, false> : std::false_type {};
746using is_double_double = bool_constant<std::numeric_limits<T>::digits == 106>;
748#ifndef FMT_USE_FULL_CACHE_DRAGONBOX
749# define FMT_USE_FULL_CACHE_DRAGONBOX 0
754template <typename T> struct allocator {
755 using value_type = T;
757 T* allocate(size_t n) {
758 FMT_ASSERT(n <= max_value<size_t>() / sizeof(T), "");
759 T* p = static_cast<T*>(malloc(n * sizeof(T)));
760 if (!p) FMT_THROW(std::bad_alloc());
764 void deallocate(T* p, size_t) { free(p); }
773enum { inline_buffer_size = 500 };
788template <typename T, size_t SIZE = inline_buffer_size,
789 typename Allocator = detail::allocator<T>>
790class basic_memory_buffer : public detail::buffer<T> {
795 FMT_NO_UNIQUE_ADDRESS Allocator alloc_;
798 FMT_CONSTEXPR20 void deallocate() {
799 T* data = this->data();
800 if (data != store_) alloc_.deallocate(data, this->capacity());
803 static
FMT_CONSTEXPR20 void grow(detail::buffer<T>& buf, size_t size) {
806 const size_t max_size =
807 std::allocator_traits<Allocator>::max_size(self.alloc_);
808 size_t old_capacity = buf.capacity();
809 size_t new_capacity = old_capacity + old_capacity / 2;
810 if (size > new_capacity)
812 else if (new_capacity > max_size)
813 new_capacity =
max_of(size, max_size);
814 T* old_data = buf.data();
815 T* new_data = self.alloc_.allocate(new_capacity);
819 memcpy(new_data, old_data, buf.size() *
sizeof(T));
820 self.set(new_data, new_capacity);
824 if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity);
832 const Allocator& alloc = Allocator())
833 :
detail::buffer<T>(grow), alloc_(alloc) {
834 this->
set(store_, SIZE);
842 alloc_ = std::move(other.alloc_);
843 T* data = other.data();
844 size_t size = other.size(), capacity = other.capacity();
845 if (data == other.store_) {
846 this->
set(store_, capacity);
849 this->
set(data, capacity);
852 other.set(other.store_, 0);
882 void reserve(
size_t new_capacity) { this->try_reserve(new_capacity); }
885 template <
typename ContiguousRange>
887 append(range.data(), range.data() + range.size());
893template <
size_t SIZE>
896 auto size = buf.size();
898 return {buf.data(), size};
911 inline writer(FILE* f) : buf_(nullptr), file_(f) {}
918 fmt::format_to(
appender(*buf_), fmt, std::forward<T>(args)...);
920 fmt::print(file_, fmt, std::forward<T>(args)...);
932 inline operator writer() {
return buf_; }
933 inline std::string&
str() {
return str_; }
936template <
typename T,
size_t SIZE,
typename Allocator>
946 using std::runtime_error::runtime_error;
972 return {s, N - (std::char_traits<Char>::to_int_type(s[N - 1]) == 0 ? 1 : 0)};
982template <
typename T, FMT_ENABLE_IF(is_
signed<T>::value)>
986template <
typename T, FMT_ENABLE_IF(!is_
signed<T>::value)>
1001#define FMT_POWERS_OF_10(factor) \
1002 factor * 10, (factor) * 100, (factor) * 1000, (factor) * 10000, \
1003 (factor) * 100000, (factor) * 1000000, (factor) * 10000000, \
1004 (factor) * 100000000, (factor) * 1000000000
1011 alignas(2)
static const char data[] =
1012 "0001020304050607080910111213141516171819"
1013 "2021222324252627282930313233343536373839"
1014 "4041424344454647484950515253545556575859"
1015 "6061626364656667686970717273747576777879"
1016 "8081828384858687888990919293949596979899";
1017 return &data[
value * 2];
1021 return static_cast<char>(((
' ' << 24) | (
'+' << 16) | (
'-' << 8)) >>
1022 (
static_cast<int>(s) * 8));
1031 if (n < 10)
return count;
1032 if (n < 100)
return count + 1;
1033 if (n < 1000)
return count + 2;
1034 if (n < 10000)
return count + 3;
1045#ifdef FMT_BUILTIN_CLZLL
1048inline auto do_count_digits(uint64_t n) ->
int {
1053 static constexpr uint8_t bsr2log10[] = {
1054 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5,
1055 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10,
1056 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,
1057 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20};
1058 auto t = bsr2log10[FMT_BUILTIN_CLZLL(n | 1) ^ 63];
1059 static constexpr const uint64_t zero_or_powers_of_10[] = {
1061 10000000000000000000ULL};
1062 return t - (n < zero_or_powers_of_10[t]);
1069#ifdef FMT_BUILTIN_CLZLL
1076template <
int BITS,
typename UInt>
1078#ifdef FMT_BUILTIN_CLZ
1080 return (FMT_BUILTIN_CLZ(
static_cast<uint32_t
>(n) | 1) ^ 31) / BITS + 1;
1087 }
while ((m >>= BITS) != 0);
1092#ifdef FMT_BUILTIN_CLZ
1095FMT_INLINE auto do_count_digits(uint32_t n) ->
int {
1098# define FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T)
1099 static constexpr uint64_t table[] = {
1100 FMT_INC(0), FMT_INC(0), FMT_INC(0),
1101 FMT_INC(10), FMT_INC(10), FMT_INC(10),
1102 FMT_INC(100), FMT_INC(100), FMT_INC(100),
1103 FMT_INC(1000), FMT_INC(1000), FMT_INC(1000),
1104 FMT_INC(10000), FMT_INC(10000), FMT_INC(10000),
1105 FMT_INC(100000), FMT_INC(100000), FMT_INC(100000),
1106 FMT_INC(1000000), FMT_INC(1000000), FMT_INC(1000000),
1107 FMT_INC(10000000), FMT_INC(10000000), FMT_INC(10000000),
1108 FMT_INC(100000000), FMT_INC(100000000), FMT_INC(100000000),
1109 FMT_INC(1000000000), FMT_INC(1000000000), FMT_INC(1000000000),
1110 FMT_INC(1000000000), FMT_INC(1000000000)
1112 auto inc = table[FMT_BUILTIN_CLZ(n | 1) ^ 31];
1113 return static_cast<int>((n + inc) >> 32);
1119#ifdef FMT_BUILTIN_CLZ
1125template <
typename Int>
constexpr auto digits10() noexcept ->
int {
1126 return std::numeric_limits<Int>::digits10;
1136template <
typename Char>
1138template <
typename Char>
1141 return {result.grouping, Char(result.thousands_sep)};
1148template <
typename Char>
1157#ifndef FMT_HEADER_ONLY
1169template <
typename Char>
auto equal2(
const Char* lhs,
const char* rhs) ->
bool {
1170 return lhs[0] == Char(rhs[0]) && lhs[1] == Char(rhs[1]);
1172inline auto equal2(
const char* lhs,
const char* rhs) ->
bool {
1173 return memcmp(lhs, rhs, 2) == 0;
1177template <
typename Char>
1184 *out++ =
static_cast<Char
>(
'0' +
value / 10);
1185 *out =
static_cast<Char
>(
'0' +
value % 10);
1190template <
typename Char,
typename UInt>
1195 while (
value >= 100) {
1207 out[--n] =
static_cast<Char
>(
'0' +
value);
1212template <
typename Char,
typename UInt>
1214 int num_digits) -> Char* {
1216 return out + num_digits;
1219template <
typename Char,
typename UInt,
typename OutputIt,
1234template <
typename Char,
typename UInt>
1236 int size,
bool upper =
false) -> Char* {
1239 const char* digits = upper ?
"0123456789ABCDEF" :
"0123456789abcdef";
1240 unsigned digit =
static_cast<unsigned>(
value & ((1 << base_bits) - 1));
1241 *--out =
static_cast<Char
>(base_bits < 4 ? static_cast<char>(
'0' + digit)
1243 }
while ((
value >>= base_bits) != 0);
1248template <
typename Char,
typename UInt>
1250 int num_digits,
bool upper =
false) -> Char* {
1252 return out + num_digits;
1255template <
typename Char,
typename OutputIt,
typename UInt,
1258 int num_digits,
bool upper =
false)
1279 return {&buffer_[0],
size()};
1281 inline auto size() const ->
size_t {
return buffer_.
size() - 1; }
1282 inline auto c_str() const -> const
wchar_t* {
return &buffer_[0]; }
1283 inline auto str() const ->
std::wstring {
return {&buffer_[0],
size()}; }
1289template <
typename WChar,
typename Buffer = memory_buffer>
class to_utf8 {
1297 static_assert(
sizeof(WChar) == 2 ||
sizeof(WChar) == 4,
1298 "Expect utf16 or utf32");
1300 FMT_THROW(std::runtime_error(
sizeof(WChar) == 2 ?
"invalid utf16"
1301 :
"invalid utf32"));
1304 auto size() const ->
size_t {
return buffer_.size() - 1; }
1305 auto c_str() const -> const
char* {
return &buffer_[0]; }
1306 auto str() const ->
std::
string {
return std::string(&buffer_[0],
size()); }
1314 if (!
convert(buffer_, s, policy))
return false;
1315 buffer_.push_back(0);
1321 for (
auto p = s.begin(); p != s.end(); ++p) {
1322 uint32_t c =
static_cast<uint32_t
>(*p);
1323 if (
sizeof(WChar) == 2 && c >= 0xd800 && c <= 0xdfff) {
1326 if (p == s.end() || (c & 0xfc00) != 0xd800 || (*p & 0xfc00) != 0xdc00) {
1332 c = (c << 10) + static_cast<uint32_t>(*p) - 0x35fdc00;
1336 buf.push_back(
static_cast<char>(c));
1337 }
else if (c < 0x800) {
1338 buf.push_back(
static_cast<char>(0xc0 | (c >> 6)));
1339 buf.push_back(
static_cast<char>(0x80 | (c & 0x3f)));
1340 }
else if ((c >= 0x800 && c <= 0xd7ff) || (c >= 0xe000 && c <= 0xffff)) {
1341 buf.push_back(
static_cast<char>(0xe0 | (c >> 12)));
1342 buf.push_back(
static_cast<char>(0x80 | ((c & 0xfff) >> 6)));
1343 buf.push_back(
static_cast<char>(0x80 | (c & 0x3f)));
1344 }
else if (c >= 0x10000 && c <= 0x10ffff) {
1345 buf.push_back(
static_cast<char>(0xf0 | (c >> 18)));
1346 buf.push_back(
static_cast<char>(0x80 | ((c & 0x3ffff) >> 12)));
1347 buf.push_back(
static_cast<char>(0x80 | ((c & 0xfff) >> 6)));
1348 buf.push_back(
static_cast<char>(0x80 | (c & 0x3f)));
1361 return {
static_cast<uint64_t
>(p >> 64),
static_cast<uint64_t
>(p)};
1362#elif defined(_MSC_VER) && defined(_M_X64)
1363 auto hi = uint64_t();
1364 auto lo = _umul128(x, y, &hi);
1369 uint64_t a = x >> 32;
1370 uint64_t b = x & mask;
1371 uint64_t c = y >> 32;
1372 uint64_t d = y & mask;
1374 uint64_t ac = a * c;
1375 uint64_t bc = b * c;
1376 uint64_t ad = a * d;
1377 uint64_t bd = b * d;
1379 uint64_t intermediate = (bd >> 32) + (ad & mask) + (bc & mask);
1381 return {ac + (intermediate >> 32) + (ad >> 32) + (bc >> 32),
1382 (intermediate << 32) + (bd & mask)};
1386namespace dragonbox {
1390 FMT_ASSERT(e <= 2620 && e >= -2620,
"too large exponent");
1391 static_assert((-1 >> 1) == -1,
"right shift is not arithmetic");
1392 return (e * 315653) >> 20;
1396 FMT_ASSERT(e <= 1233 && e >= -1233,
"too large exponent");
1397 return (e * 1741647) >> 19;
1404 return static_cast<uint64_t
>(p >> 64);
1405#elif defined(_MSC_VER) && defined(_M_X64)
1406 return __umulh(x, y);
1428 static const int exponent_bits = 8;
1429 static const int kappa = 1;
1430 static const int big_divisor = 100;
1431 static const int small_divisor = 10;
1432 static const int min_k = -31;
1433 static const int max_k = 46;
1434 static const int shorter_interval_tie_lower_threshold = -35;
1435 static const int shorter_interval_tie_upper_threshold = -35;
1440 static const int exponent_bits = 11;
1441 static const int kappa = 2;
1442 static const int big_divisor = 1000;
1443 static const int small_divisor = 100;
1444 static const int min_k = -292;
1445 static const int max_k = 341;
1446 static const int shorter_interval_tie_lower_threshold = -77;
1447 static const int shorter_interval_tie_upper_threshold = -77;
1451template <
typename T>
1453 std::numeric_limits<T>::digits == 113 ||
1456 static const int exponent_bits = 15;
1460template <
typename T>
1477 return std::numeric_limits<Float>::digits != 64;
1485 : (std::numeric_limits<Float>::digits -
1489template <
typename Float>
1499 : std::numeric_limits<Float>::max_exponent - 1;
1503template <
typename Char,
typename OutputIt>
1507 *out++ =
static_cast<Char
>(
'-');
1510 *out++ =
static_cast<Char
>(
'+');
1512 auto uexp =
static_cast<uint32_t
>(
exp);
1514 if (uexp < 10) *out++ =
'0';
1518 const char* top =
digits2(uexp / 100);
1519 if (uexp >= 1000u) *out++ =
static_cast<Char
>(top[0]);
1520 *out++ =
static_cast<Char
>(top[1]);
1523 const char* d =
digits2(uexp);
1524 *out++ =
static_cast<Char
>(d[0]);
1525 *out++ =
static_cast<Char
>(d[1]);
1538 constexpr basic_fp(uint64_t f_val,
int e_val) :
f(f_val),
e(e_val) {}
1544 template <
typename Float, FMT_ENABLE_IF(!is_
double_
double<Float>::value)>
1546 static_assert(std::numeric_limits<Float>::digits <= 113,
"unsupported FP");
1549 const auto num_float_significand_bits =
1551 const auto implicit_bit = carrier_uint(1) << num_float_significand_bits;
1552 const auto significand_mask = implicit_bit - 1;
1554 f =
static_cast<F
>(u & significand_mask);
1556 num_float_significand_bits);
1559 auto is_predecessor_closer =
f == 0 && biased_e > 1;
1563 f +=
static_cast<F
>(implicit_bit);
1566 return is_predecessor_closer;
1569 template <
typename Float, FMT_ENABLE_IF(is_
double_
double<Float>::value)>
1571 static_assert(std::numeric_limits<double>::is_iec559,
"unsupported FP");
1572 return assign(
static_cast<double>(n));
1579template <
int SHIFT = 0,
typename F>
1583 const auto shifted_implicit_bit = implicit_bit << SHIFT;
1584 while ((
value.f & shifted_implicit_bit) == 0) {
1599 auto product =
static_cast<__uint128_t
>(lhs) * rhs;
1600 auto f =
static_cast<uint64_t
>(product >> 64);
1601 return (
static_cast<uint64_t
>(product) & (1ULL << 63)) != 0 ? f + 1 : f;
1604 uint64_t mask = (1ULL << 32) - 1;
1605 uint64_t a = lhs >> 32, b = lhs & mask;
1606 uint64_t c = rhs >> 32, d = rhs & mask;
1607 uint64_t ac = a * c, bc = b * c, ad = a * d, bd = b * d;
1609 uint64_t mid = (bd >> 32) + (ad & mask) + (bc & mask) + (1U << 31);
1610 return ac + (ad >> 32) + (bc >> 32) + (mid >> 32);
1615 return {
multiply(x.f, y.f), x.e + y.e + 64};
1622template <
typename T>
1627template <
typename Char,
typename OutputIt>
1630 auto fill_size = specs.fill_size();
1631 if (fill_size == 1)
return detail::fill_n(it, n, specs.fill_unit<Char>());
1632 if (
const Char* data = specs.fill<Char>()) {
1633 for (
size_t i = 0; i < n; ++i) it = copy<Char>(data, data + fill_size, it);
1641template <
typename Char,
align default_align =
align::left,
typename OutputIt,
1644 size_t size,
size_t width, F&& f) -> OutputIt {
1648 size_t padding = spec_width >
width ? spec_width -
width : 0;
1652 default_align ==
align::left ?
"\x1f\x1f\x00\x01" :
"\x00\x1f\x00\x01";
1653 size_t left_padding = padding >> shifts[
static_cast<int>(specs.align())];
1654 size_t right_padding = padding - left_padding;
1655 auto it =
reserve(out, size + padding * specs.fill_size());
1656 if (left_padding != 0) it =
fill<Char>(it, left_padding, specs);
1658 if (right_padding != 0) it =
fill<Char>(it, right_padding, specs);
1662template <
typename Char,
align default_align =
align::left,
typename OutputIt,
1665 size_t size, F&& f) -> OutputIt {
1669template <
typename Char, align default_align = align::left,
typename OutputIt>
1674 const char* data = bytes.data();
1675 return copy<Char>(data, data + bytes.size(), it);
1679template <
typename Char,
typename OutputIt,
typename UIntPtr>
1685 *it++ =
static_cast<Char
>(
'0');
1686 *it++ =
static_cast<Char
>(
'x');
1697 if (cp < 0x20 || cp == 0x7f || cp ==
'"' || cp ==
'\\')
return true;
1708template <
typename Char>
1711 for (; begin != end; ++begin) {
1713 if (
const_check(
sizeof(Char) == 1) && cp >= 0x80)
continue;
1716 return {begin,
nullptr, 0};
1726 result = {sv.
begin(), sv.
end(), cp};
1734template <
size_t w
idth,
typename Char,
typename OutputIt>
1736 *out++ =
static_cast<Char
>(
'\\');
1737 *out++ =
static_cast<Char
>(prefix);
1744template <
typename OutputIt,
typename Char>
1747 auto c =
static_cast<Char
>(
escape.cp);
1750 *out++ =
static_cast<Char
>(
'\\');
1751 c =
static_cast<Char
>(
'n');
1754 *out++ =
static_cast<Char
>(
'\\');
1755 c =
static_cast<Char
>(
'r');
1758 *out++ =
static_cast<Char
>(
'\\');
1759 c =
static_cast<Char
>(
't');
1763 case '\\': *out++ =
static_cast<Char
>(
'\\');
break;
1768 if (
escape.cp < 0x110000)
1773 static_cast<uint32_t
>(escape_char) & 0xFF);
1781template <
typename Char,
typename OutputIt>
1784 *out++ =
static_cast<Char
>(
'"');
1785 auto begin = str.begin(), end = str.end();
1792 }
while (begin != end);
1793 *out++ =
static_cast<Char
>(
'"');
1797template <
typename Char,
typename OutputIt>
1799 Char v_array[1] = {v};
1800 *out++ =
static_cast<Char
>(
'\'');
1801 if ((
needs_escape(
static_cast<uint32_t
>(v)) && v !=
static_cast<Char
>(
'"')) ||
1802 v ==
static_cast<Char
>(
'\'')) {
1805 static_cast<uint32_t
>(v)});
1809 *out++ =
static_cast<Char
>(
'\'');
1813template <
typename Char,
typename OutputIt>
1823template <
typename Char,
typename OutputIt>
1827 using unsigned_type =
1831 :
write<Char>(out, static_cast<unsigned_type>(
value), specs, loc);
1836 std::string grouping_;
1837 std::basic_string<Char> thousands_sep_;
1840 std::string::const_iterator group;
1843 auto initial_state()
const -> next_state {
return {grouping_.begin(), 0}; }
1846 auto next(next_state&
state)
const ->
int {
1848 if (
state.group == grouping_.end())
return state.pos += grouping_.back();
1857 if (!localized)
return;
1859 grouping_ = sep.grouping;
1860 if (sep.thousands_sep) thousands_sep_.assign(1, sep.thousands_sep);
1863 : grouping_(
std::move(grouping)), thousands_sep_(
std::move(sep)) {}
1869 auto state = initial_state();
1875 template <
typename Out,
typename C>
1877 auto num_digits =
static_cast<int>(digits.size());
1879 separators.push_back(0);
1880 auto state = initial_state();
1881 while (
int i = next(
state)) {
1882 if (i >= num_digits)
break;
1883 separators.push_back(i);
1885 for (
int i = 0, sep_index =
static_cast<int>(separators.size() - 1);
1886 i < num_digits; ++i) {
1887 if (num_digits - i == separators[sep_index]) {
1889 thousands_sep_.data() + thousands_sep_.size(), out);
1892 *out++ =
static_cast<Char
>(digits[
to_unsigned(i)]);
1900 prefix += (1u + (
value > 0xff ? 1 : 0)) << 24;
1904template <
typename OutputIt,
typename UInt,
typename Char>
1908 static_assert(std::is_same<uint64_or_128_t<UInt>, UInt>
::value,
"");
1911 switch (specs.
type()) {
1942 unsigned size = (prefix != 0 ? prefix >> 24 : 0) +
to_unsigned(num_digits) +
1943 to_unsigned(grouping.count_separators(num_digits));
1946 for (
unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
1947 *it++ =
static_cast<Char
>(p & 0xff);
1955 locale_ref loc) -> bool;
1957template <
typename OutputIt>
1968template <
typename T>
1974 prefix = 0x01000000 |
'-';
1975 abs_value = 0 - abs_value;
1977 constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u |
'+',
1979 prefix = prefixes[
static_cast<int>(s)];
1981 return {abs_value, prefix};
1991 template <
typename T, FMT_ENABLE_IF(is_
integer<T>::value)>
1999 template <
typename T, FMT_ENABLE_IF(!is_
integer<T>::value)>
2014 auto width = to_unsigned(specs.width);
2016 padding = width - size;
2019 }
else if (specs.
precision > num_digits) {
2020 size = (prefix >> 24) + to_unsigned(specs.precision);
2021 padding = to_unsigned(specs.precision - num_digits);
2026template <
typename Char,
typename OutputIt,
typename T>
2029 static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value,
"");
2031 constexpr int buffer_size = num_bits<T>();
2032 char buffer[buffer_size];
2034 const char* begin =
nullptr;
2035 const char* end =
buffer + buffer_size;
2037 auto abs_value =
arg.abs_value;
2038 auto prefix =
arg.prefix;
2039 switch (specs.
type()) {
2054 auto num_digits = end - begin;
2055 if (specs.
alt() && specs.
precision <= num_digits && abs_value != 0)
2065 return write_char<Char>(out,
static_cast<Char
>(abs_value), specs);
2071 int num_digits =
static_cast<int>(end - begin);
2075 for (
unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
2076 *it++ =
static_cast<Char
>(p & 0xff);
2080 unsigned padding = sp.padding;
2081 return write_padded<Char, align::right>(
2083 for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
2084 *it++ = static_cast<Char>(p & 0xff);
2085 it = detail::fill_n(it, padding, static_cast<Char>(
'0'));
2086 return copy<Char>(begin, end, it);
2090template <
typename Char,
typename OutputIt,
typename T>
2095 return write_int<Char>(out,
arg, specs);
2098template <
typename Char,
typename T,
2100 !std::is_same<T, bool>::value &&
2101 !std::is_same<T, Char>::value)>
2111template <
typename Char,
typename OutputIt,
typename T,
2113 !std::is_same<T, bool>::value &&
2114 !std::is_same<T, Char>::value &&
2123template <
typename Char,
typename OutputIt>
2126 auto data = s.data();
2127 auto size = s.size();
2139 if (specs.
width != 0) {
2143 return write_padded<Char>(
2146 : copy<Char>(data, data + size, it);
2149template <
typename Char,
typename OutputIt>
2152 return write<Char>(out, s, specs);
2154template <
typename Char,
typename OutputIt>
2158 return write_ptr<Char>(out, bit_cast<uintptr_t>(s), &specs);
2163template <
typename Char,
typename OutputIt,
typename T,
2165 !std::is_same<T, bool>::value &&
2166 !std::is_same<T, Char>::value)>
2171 if (negative) abs_value = ~abs_value + 1;
2173 auto size = (negative ? 1 : 0) +
static_cast<size_t>(num_digits);
2174 if (
auto ptr = to_pointer<Char>(out, size)) {
2175 if (negative) *
ptr++ =
static_cast<Char
>(
'-');
2176 format_decimal<Char>(
ptr, abs_value, num_digits);
2179 if (negative) *out++ =
static_cast<Char
>(
'-');
2180 return format_decimal<Char>(out, abs_value, num_digits);
2183template <
typename Char>
2189 if (end - p <= 0) p = begin;
2199 if (c ==
'}')
return begin;
2210 }
else if (p == begin) {
2219template <
typename Char,
typename OutputIt>
2223 isnan ? (specs.
upper() ?
"NAN" :
"nan") : (specs.
upper() ?
"INF" :
"inf");
2224 constexpr size_t str_size = 3;
2225 auto size = str_size + (s !=
sign::none ? 1 : 0);
2227 const bool is_zero_fill =
2229 if (is_zero_fill) specs.
set_fill(
' ');
2230 return write_padded<Char>(out, specs, size,
2234 return copy<Char>(str, str + str_size, it);
2246 return f.significand_size;
2248template <
typename T>
2253template <
typename Char,
typename OutputIt>
2255 int significand_size) -> OutputIt {
2256 return copy<Char>(significand, significand + significand_size, out);
2258template <
typename Char,
typename OutputIt,
typename UInt>
2260 int significand_size) -> OutputIt {
2261 return format_decimal<Char>(out, significand, significand_size);
2263template <
typename Char,
typename OutputIt,
typename T,
typename Grouping>
2265 int significand_size,
int exponent,
2266 const Grouping& grouping) -> OutputIt {
2267 if (!grouping.has_separator()) {
2268 out = write_significand<Char>(out, significand, significand_size);
2272 write_significand<char>(
appender(
buffer), significand, significand_size);
2277template <
typename Char,
typename UInt,
2280 int integral_size, Char decimal_point) -> Char* {
2282 out += significand_size + 1;
2284 int floating_size = significand_size - integral_size;
2285 for (
int i = floating_size / 2; i > 0; --i) {
2287 write2digits(out,
static_cast<std::size_t
>(significand % 100));
2290 if (floating_size % 2 != 0) {
2291 *--out =
static_cast<Char
>(
'0' + significand % 10);
2299template <
typename OutputIt,
typename UInt,
typename Char,
2302 int significand_size,
int integral_size,
2303 Char decimal_point) -> OutputIt {
2305 Char
buffer[digits10<UInt>() + 2];
2311template <
typename OutputIt,
typename Char>
2313 int significand_size,
int integral_size,
2314 Char decimal_point) -> OutputIt {
2320 significand + significand_size, out);
2323template <
typename OutputIt,
typename Char,
typename T,
typename Grouping>
2325 int significand_size,
int integral_size,
2327 const Grouping& grouping) -> OutputIt {
2328 if (!grouping.has_separator()) {
2341template <
typename Char,
typename OutputIt,
typename DecimalFP,
2342 typename Grouping = digit_grouping<Char>>
2346 auto significand = f.significand;
2348 const Char
zero =
static_cast<Char
>(
'0');
2353 :
static_cast<Char
>(
'.');
2355 int output_exp = f.exponent + significand_size - 1;
2356 auto use_exp_format = [=]() {
2361 const int exp_lower = -4, exp_upper = 16;
2362 return output_exp < exp_lower ||
2365 if (use_exp_format()) {
2368 num_zeros = specs.
precision - significand_size;
2369 if (num_zeros < 0) num_zeros = 0;
2371 }
else if (significand_size == 1) {
2372 decimal_point = Char();
2374 auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp;
2376 if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3;
2378 size +=
to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits);
2379 char exp_char = specs.
upper() ?
'E' :
'e';
2380 auto write = [=](iterator it) {
2386 *it++ =
static_cast<Char
>(exp_char);
2387 return write_exponent<Char>(output_exp, it);
2389 return specs.
width > 0
2390 ? write_padded<Char, align::right>(out, specs, size, write)
2394 int exp = f.exponent + significand_size;
2395 if (f.exponent >= 0) {
2404 if (num_zeros > 0) size +=
to_unsigned(num_zeros);
2406 auto grouping = Grouping(loc, specs.
localized());
2408 return write_padded<Char, align::right>(out, specs, size, [&](iterator it) {
2410 it = write_significand<Char>(it, significand, significand_size,
2411 f.exponent, grouping);
2412 if (!specs.
alt())
return it;
2416 }
else if (
exp > 0) {
2418 int num_zeros = specs.
alt() ? specs.
precision - significand_size : 0;
2419 size += 1 +
static_cast<unsigned>(
max_of(num_zeros, 0));
2420 auto grouping = Grouping(loc, specs.
localized());
2422 return write_padded<Char, align::right>(out, specs, size, [&](iterator it) {
2425 decimal_point, grouping);
2430 int num_zeros = -
exp;
2431 if (significand_size == 0 && specs.
precision >= 0 &&
2435 bool pointy = num_zeros != 0 || significand_size != 0 || specs.
alt();
2436 size += 1 + (pointy ? 1 : 0) +
to_unsigned(num_zeros);
2437 return write_padded<Char, align::right>(out, specs, size, [&](iterator it) {
2440 if (!pointy)
return it;
2443 return write_significand<Char>(it, significand, significand_size);
2455 template <
typename Out,
typename C>
2461template <
typename Char,
typename OutputIt,
typename DecimalFP>
2469 return do_write_float<Char>(out, f, specs, s, loc);
2477template <
typename T,
typename Enable =
void>
2480template <
typename T>
2482 : std::true_type {};
2484template <
typename T, FMT_ENABLE_IF(std::is_
floating_po
int<T>::value&&
2485 has_isfinite<T>::value)>
2487 constexpr T inf = T(std::numeric_limits<double>::infinity());
2490 return std::isfinite(
value);
2492template <
typename T, FMT_ENABLE_IF(!has_isfinite<T>::value)>
2494 T inf = T(std::numeric_limits<double>::infinity());
2499template <
typename T, FMT_ENABLE_IF(is_
floating_po
int<T>::value)>
2502#ifdef __cpp_if_constexpr
2503 if constexpr (std::numeric_limits<double>::is_iec559) {
2505 return (bits >> (num_bits<uint64_t>() - 1)) != 0;
2509 return std::signbit(
static_cast<double>(
value));
2515 if (exp10 > 0 &&
precision > max_value<int>() - exp10)
2516 FMT_THROW(format_error(
"number is too big"));
2523 using bigit = uint32_t;
2524 using double_bigit = uint64_t;
2525 enum { bigit_bits = num_bits<bigit>() };
2526 enum { bigits_capacity = 32 };
2533 return i >= exp_ && i < num_bigits() ? bigits_[i - exp_] : 0;
2537 auto result = double_bigit(bigits_[
index]) - other - borrow;
2538 bigits_[
index] =
static_cast<bigit
>(result);
2539 borrow =
static_cast<bigit
>(result >> (bigit_bits * 2 - 1));
2543 int num_bigits =
static_cast<int>(bigits_.
size()) - 1;
2544 while (num_bigits > 0 && bigits_[num_bigits] == 0) --num_bigits;
2545 bigits_.
resize(to_unsigned(num_bigits + 1));
2550 FMT_ASSERT(other.exp_ >= exp_,
"unaligned bigints");
2553 int i = other.exp_ - exp_;
2554 for (
size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j)
2555 subtract_bigits(i, other.bigits_[j], borrow);
2556 if (borrow != 0) subtract_bigits(i, 0, borrow);
2558 remove_leading_zeros();
2563 const double_bigit wide_value =
value;
2564 for (
size_t i = 0, n = bigits_.
size(); i < n; ++i) {
2565 double_bigit result = bigits_[i] * wide_value + carry;
2566 bigits_[i] =
static_cast<bigit
>(result);
2567 carry =
static_cast<bigit
>(result >> bigit_bits);
2569 if (carry != 0) bigits_.
push_back(carry);
2572 template <
typename UInt, FMT_ENABLE_IF(std::is_same<UInt, u
int64_t>::value ||
2573 std::is_same<UInt, u
int128_t>::value)>
2577 const int shift = num_bits<half_uint>() - bigit_bits;
2578 const UInt lower =
static_cast<half_uint
>(
value);
2579 const UInt upper =
value >> num_bits<half_uint>();
2581 for (
size_t i = 0, n = bigits_.
size(); i < n; ++i) {
2582 UInt result = lower * bigits_[i] +
static_cast<bigit
>(carry);
2583 carry = (upper * bigits_[i] << shift) + (result >> bigit_bits) +
2584 (carry >> bigit_bits);
2585 bigits_[i] =
static_cast<bigit
>(result);
2587 while (carry != 0) {
2588 bigits_.
push_back(
static_cast<bigit
>(carry));
2589 carry >>= bigit_bits;
2593 template <
typename UInt, FMT_ENABLE_IF(std::is_same<UInt, u
int64_t>::value ||
2594 std::is_same<UInt, u
int128_t>::value)>
2596 size_t num_bigits = 0;
2598 bigits_[num_bigits++] =
static_cast<bigit
>(n);
2601 bigits_.
resize(num_bigits);
2613 auto size = other.bigits_.size();
2615 auto data = other.bigits_.data();
2616 copy<bigit>(data, data + size, bigits_.
data());
2626 return static_cast<int>(bigits_.
size()) + exp_;
2631 exp_ += shift / bigit_bits;
2632 shift %= bigit_bits;
2633 if (shift == 0)
return *
this;
2635 for (
size_t i = 0, n = bigits_.
size(); i < n; ++i) {
2636 bigit c = bigits_[i] >> (bigit_bits - shift);
2637 bigits_[i] = (bigits_[i] << shift) + carry;
2640 if (carry != 0) bigits_.
push_back(carry);
2651 int num_bigits1 = b1.num_bigits(), num_bigits2 = b2.num_bigits();
2652 if (num_bigits1 != num_bigits2)
return num_bigits1 > num_bigits2 ? 1 : -1;
2653 int i =
static_cast<int>(b1.bigits_.size()) - 1;
2654 int j =
static_cast<int>(b2.bigits_.size()) - 1;
2656 if (end < 0) end = 0;
2657 for (; i >= end; --i, --j) {
2658 bigit b1_bigit = b1.bigits_[i], b2_bigit = b2.bigits_[j];
2659 if (b1_bigit != b2_bigit)
return b1_bigit > b2_bigit ? 1 : -1;
2661 if (i != j)
return i > j ? 1 : -1;
2667 const bigint& rhs) ->
int {
2668 int max_lhs_bigits =
max_of(lhs1.num_bigits(), lhs2.num_bigits());
2669 int num_rhs_bigits = rhs.num_bigits();
2670 if (max_lhs_bigits + 1 < num_rhs_bigits)
return -1;
2671 if (max_lhs_bigits > num_rhs_bigits)
return 1;
2672 double_bigit borrow = 0;
2673 int min_exp =
min_of(
min_of(lhs1.exp_, lhs2.exp_), rhs.exp_);
2674 for (
int i = num_rhs_bigits - 1; i >= min_exp; --i) {
2675 double_bigit sum = double_bigit(lhs1.get_bigit(i)) + lhs2.get_bigit(i);
2676 bigit rhs_bigit = rhs.get_bigit(i);
2677 if (sum > rhs_bigit + borrow)
return 1;
2678 borrow = rhs_bigit + borrow - sum;
2679 if (borrow > 1)
return -1;
2680 borrow <<= bigit_bits;
2682 return borrow != 0 ? -1 : 0;
2688 if (
exp == 0)
return *
this = 1;
2689 int bitmask = 1 << (num_bits<unsigned>() -
2695 while (bitmask != 0) {
2697 if ((
exp & bitmask) != 0) *
this *= 5;
2704 int num_bigits =
static_cast<int>(bigits_.
size());
2705 int num_result_bigits = 2 * num_bigits;
2709 for (
int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) {
2712 for (
int i = 0, j = bigit_index; j >= 0; ++i, --j) {
2714 sum += double_bigit(n[i]) * n[j];
2716 bigits_[bigit_index] =
static_cast<bigit
>(sum);
2717 sum >>= num_bits<bigit>();
2720 for (
int bigit_index = num_bigits; bigit_index < num_result_bigits;
2722 for (
int j = num_bigits - 1, i = bigit_index - j; i < num_bigits;)
2723 sum += double_bigit(n[i++]) * n[j--];
2724 bigits_[bigit_index] =
static_cast<bigit
>(sum);
2725 sum >>= num_bits<bigit>();
2727 remove_leading_zeros();
2734 int exp_difference = exp_ - other.exp_;
2735 if (exp_difference <= 0)
return;
2736 int num_bigits =
static_cast<int>(bigits_.
size());
2738 for (
int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j)
2739 bigits_[j] = bigits_[i];
2740 memset(bigits_.
data(), 0,
to_unsigned(exp_difference) *
sizeof(bigit));
2741 exp_ -= exp_difference;
2748 if (
compare(*
this, divisor) < 0)
return 0;
2749 FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0,
"");
2753 subtract_aligned(divisor);
2755 }
while (
compare(*
this, divisor) >= 0);
2771 unsigned flags,
int num_digits,
2782 bool is_predecessor_closer = (flags & dragon::predecessor_closer) != 0;
2783 int shift = is_predecessor_closer ? 2 : 1;
2785 numerator =
value.f;
2786 numerator <<=
value.e + shift;
2789 if (is_predecessor_closer) {
2791 upper_store <<=
value.e + 1;
2792 upper = &upper_store;
2795 denominator <<= shift;
2796 }
else if (exp10 < 0) {
2798 lower.assign(numerator);
2799 if (is_predecessor_closer) {
2800 upper_store.assign(numerator);
2802 upper = &upper_store;
2804 numerator *=
value.f;
2805 numerator <<= shift;
2807 denominator <<= shift -
value.e;
2809 numerator =
value.f;
2810 numerator <<= shift;
2812 denominator <<= shift -
value.e;
2814 if (is_predecessor_closer) {
2815 upper_store = 1ULL << 1;
2816 upper = &upper_store;
2819 int even =
static_cast<int>((
value.f & 1) == 0);
2820 if (!upper) upper = &lower;
2821 bool shortest = num_digits < 0;
2822 if ((flags & dragon::fixup) != 0) {
2823 if (add_compare(numerator, *upper, denominator) + even <= 0) {
2826 if (num_digits < 0) {
2828 if (upper != &lower) *upper *= 10;
2837 char* data = buf.
data();
2840 bool low =
compare(numerator, lower) - even < 0;
2842 bool high = add_compare(numerator, *upper, denominator) + even > 0;
2843 data[num_digits++] =
static_cast<char>(
'0' + digit);
2846 ++data[num_digits - 1];
2848 int result = add_compare(numerator, numerator, denominator);
2850 if (result > 0 || (result == 0 && (digit % 2) != 0))
2851 ++data[num_digits - 1];
2854 exp10 -= num_digits - 1;
2859 if (upper != &lower) *upper *= 10;
2863 exp10 -= num_digits - 1;
2864 if (num_digits <= 0) {
2866 if (num_digits == 0) {
2868 digit = add_compare(numerator, numerator, denominator) > 0 ?
'1' :
'0';
2874 for (
int i = 0; i < num_digits - 1; ++i) {
2876 buf[i] =
static_cast<char>(
'0' + digit);
2880 auto result = add_compare(numerator, numerator, denominator);
2881 if (result > 0 || (result == 0 && (digit % 2) != 0)) {
2883 const auto overflow =
'0' + 10;
2884 buf[num_digits - 1] = overflow;
2886 for (
int i = num_digits - 1; i > 0 && buf[i] == overflow; --i) {
2890 if (buf[0] == overflow) {
2892 if ((flags & dragon::fixed) != 0)
2901 buf[num_digits - 1] =
static_cast<char>(
'0' + digit);
2905template <
typename Float, FMT_ENABLE_IF(!is_
double_
double<Float>::value)>
2910 static_assert(!std::is_same<Float, float>::value,
"");
2915 using carrier_uint =
typename info::carrier_uint;
2920 f.
e += num_float_significand_bits;
2921 if (!has_implicit_bit<Float>()) --f.
e;
2923 const auto num_fraction_bits =
2924 num_float_significand_bits + (has_implicit_bit<Float>() ? 1 : 0);
2925 const auto num_xdigits = (num_fraction_bits + 3) / 4;
2927 const auto leading_shift = ((num_xdigits - 1) * 4);
2928 const auto leading_mask = carrier_uint(0xF) << leading_shift;
2929 const auto leading_xdigit =
2930 static_cast<uint32_t
>((f.
f & leading_mask) >> leading_shift);
2931 if (leading_xdigit > 1) f.
e -= (32 -
countl_zero(leading_xdigit) - 1);
2933 int print_xdigits = num_xdigits - 1;
2935 const int shift = ((print_xdigits - specs.
precision - 1) * 4);
2936 const auto mask = carrier_uint(0xF) << shift;
2937 const auto v =
static_cast<uint32_t
>((f.
f & mask) >> shift);
2940 const auto inc = carrier_uint(1) << (shift + 4);
2946 if (!has_implicit_bit<Float>()) {
2947 const auto implicit_bit = carrier_uint(1) << num_float_significand_bits;
2948 if ((f.
f & implicit_bit) == implicit_bit) {
2957 char xdigits[num_bits<carrier_uint>() / 4];
2962 while (print_xdigits > 0 && xdigits[print_xdigits] ==
'0') --print_xdigits;
2967 if (specs.
alt() || print_xdigits > 0 || print_xdigits < specs.
precision)
2969 buf.
append(xdigits + 1, xdigits + 1 + print_xdigits);
2977 abs_e =
static_cast<uint32_t
>(-f.
e);
2980 abs_e =
static_cast<uint32_t
>(f.
e);
2985template <
typename Float, FMT_ENABLE_IF(is_
double_
double<Float>::value)>
2987 buffer<char>& buf) {
2988 format_hexfloat(
static_cast<double>(value), specs, buf);
2998 return U
"\x9999999a\x828f5c29\x80418938\x80068db9\x8000a7c6\x800010c7"
2999 U
"\x800001ae\x8000002b"[
index];
3002template <
typename Float>
3007 static_assert(!std::is_same<Float, float>::value,
"");
3022 bool use_dragon =
true;
3023 unsigned dragon_flags = 0;
3025 const auto inv_log2_10 = 0.3010299956639812;
3032 auto e = (f.e + count_digits<1>(f.f) - 1) * inv_log2_10 - 1e-10;
3033 exp =
static_cast<int>(e);
3035 dragon_flags = dragon::fixup;
3039 auto br = bit_cast<uint64_t>(
static_cast<double>(
value));
3041 const uint64_t significand_mask =
3042 (
static_cast<uint64_t
>(1) << num_significand_bits<double>()) - 1;
3043 uint64_t significand = (br & significand_mask);
3044 int exponent =
static_cast<int>((br & exponent_mask<double>()) >>
3045 num_significand_bits<double>());
3047 if (exponent != 0) {
3048 exponent -= exponent_bias<double>() + num_significand_bits<double>();
3050 (
static_cast<uint64_t
>(1) << num_significand_bits<double>());
3054 FMT_ASSERT(significand != 0,
"zeros should not appear here");
3056 FMT_ASSERT(shift >= num_bits<uint64_t>() - num_significand_bits<double>(),
3058 shift -= (num_bits<uint64_t>() - num_significand_bits<double>() - 2);
3059 exponent = (std::numeric_limits<double>::min_exponent -
3060 num_significand_bits<double>()) -
3062 significand <<= shift;
3067 const int k = info::kappa - dragonbox::floor_log10_pow2(exponent);
3069 const int beta = exponent + dragonbox::floor_log2_pow10(k);
3070 uint64_t first_segment;
3071 bool has_more_segments;
3072 int digits_in_the_first_segment;
3074 const auto r = dragonbox::umul192_upper128(
3075 significand << beta, dragonbox::get_cached_power(k));
3076 first_segment = r.high();
3077 has_more_segments = r.low() != 0;
3080 if (first_segment >= 1000000000000000000ULL) {
3081 digits_in_the_first_segment = 19;
3085 digits_in_the_first_segment = 18;
3086 first_segment *= 10;
3095 if (digits_in_the_first_segment >
precision) {
3099 exp += digits_in_the_first_segment;
3107 if ((first_segment |
static_cast<uint64_t
>(has_more_segments)) >
3108 5000000000000000000ULL) {
3125 const uint32_t first_subsegment =
static_cast<uint32_t
>(
3126 dragonbox::umul128_upper64(first_segment, 7922816251426433760ULL) >>
3128 const uint64_t second_third_subsegments =
3129 first_segment - first_subsegment * 10000000000ULL;
3133 bool should_round_up;
3137 auto print_subsegment = [&](uint32_t subsegment,
char*
buffer) {
3138 int number_of_digits_printed = 0;
3141 if ((number_of_digits_to_print & 1) != 0) {
3147 prod = ((subsegment *
static_cast<uint64_t
>(720575941)) >> 24) + 1;
3148 digits =
static_cast<uint32_t
>(prod >> 32);
3149 *
buffer =
static_cast<char>(
'0' + digits);
3150 number_of_digits_printed++;
3160 prod = ((subsegment *
static_cast<uint64_t
>(450359963)) >> 20) + 1;
3161 digits =
static_cast<uint32_t
>(prod >> 32);
3163 number_of_digits_printed += 2;
3167 while (number_of_digits_printed < number_of_digits_to_print) {
3168 prod =
static_cast<uint32_t
>(prod) *
static_cast<uint64_t
>(100);
3169 digits =
static_cast<uint32_t
>(prod >> 32);
3171 number_of_digits_printed += 2;
3176 print_subsegment(first_subsegment, buf.data());
3195 uint32_t fractional_part =
static_cast<uint32_t
>(prod);
3198 8 - number_of_digits_to_print) ||
3199 ((fractional_part >> 31) &
3200 ((digits & 1) | (second_third_subsegments != 0) |
3201 has_more_segments)) != 0;
3209 should_round_up = second_third_subsegments > 5000000000ULL ||
3210 (second_third_subsegments == 5000000000ULL &&
3211 ((digits & 1) != 0 || has_more_segments));
3220 const uint32_t second_subsegment =
3221 static_cast<uint32_t
>(dragonbox::umul128_upper64(
3222 second_third_subsegments, 1844674407370955162ULL));
3223 const uint32_t third_subsegment =
3224 static_cast<uint32_t
>(second_third_subsegments) -
3225 second_subsegment * 10;
3227 number_of_digits_to_print =
precision - 9;
3228 print_subsegment(second_subsegment, buf.data() + 9);
3235 uint32_t fractional_part =
static_cast<uint32_t
>(prod);
3238 8 - number_of_digits_to_print) ||
3239 ((fractional_part >> 31) &
3240 ((digits & 1) | (third_subsegment != 0) |
3241 has_more_segments)) != 0;
3248 should_round_up = third_subsegment > 5 ||
3249 (third_subsegment == 5 &&
3250 ((digits & 1) != 0 || has_more_segments));
3255 if (should_round_up) {
3257 for (
int i =
precision - 1; i > 0 && buf[i] >
'9'; --i) {
3274 exp += digits_in_the_first_segment - 1;
3279 bool is_predecessor_closer = binary32 ? f.assign(
static_cast<float>(
value))
3280 : f.assign(converted_value);
3281 if (is_predecessor_closer) dragon_flags |= dragon::predecessor_closer;
3282 if (
fixed) dragon_flags |= dragon::fixed;
3285 const int max_double_digits = 767;
3291 auto num_digits = buf.size();
3292 while (num_digits > 0 && buf[num_digits - 1] ==
'0') {
3296 buf.try_resize(num_digits);
3301template <
typename Char,
typename OutputIt,
typename T>
3322 using floaty =
conditional_t<
sizeof(T) >=
sizeof(
double), double,
float>;
3323 auto dec = dragonbox::to_decimal(
static_cast<floaty
>(
value));
3324 return write_float<Char>(out,
dec, specs, s, loc);
3348 std::is_same<T, float>(),
buffer);
3352 return write_float<Char>(out, f, specs, s, loc);
3355template <
typename Char,
typename OutputIt,
typename T,
3359 return specs.
localized() && write_loc(out, value, specs, loc)
3361 : write_float<Char>(out, value, specs, loc);
3364template <
typename Char,
typename OutputIt,
typename T,
3372 using floaty =
conditional_t<
sizeof(T) >=
sizeof(
double), double,
float>;
3374 floaty_uint mask = exponent_mask<floaty>();
3375 if ((bit_cast<floaty_uint>(
value) & mask) == mask)
3376 return write_nonfinite<Char>(out, std::isnan(
value), specs, s);
3378 auto dec = dragonbox::to_decimal(
static_cast<floaty
>(
value));
3379 return write_float<Char>(out,
dec, specs, s, {});
3382template <
typename Char,
typename OutputIt,
typename T,
3384 !is_fast_float<T>::value)>
3389template <
typename Char,
typename OutputIt>
3396template <
typename Char,
typename OutputIt>
3399 return copy_noinline<Char>(
value.begin(),
value.end(), out);
3402template <
typename Char,
typename OutputIt,
typename T,
3410 typename Char,
typename OutputIt,
typename T,
3411 bool check = std::is_enum<T>::value && !std::is_same<T, Char>::value &&
3412 mapped_type_constant<T, Char>::value != type::custom_type,
3418template <
typename Char,
typename OutputIt,
typename T,
3421 locale_ref = {}) -> OutputIt {
3424 ? write<Char>(out, value ? 1 : 0, specs, {})
3428template <
typename Char,
typename OutputIt>
3435template <
typename Char,
typename OutputIt>
3442template <
typename Char,
typename OutputIt,
typename T,
3445 locale_ref = {}) -> OutputIt {
3446 return write_ptr<Char>(out, bit_cast<uintptr_t>(value), &specs);
3449template <
typename Char,
typename OutputIt,
typename T,
3451 type::custom_type &&
3452 !std::is_fundamental<T>::value)>
3458 return f.format(
value, ctx);
3461template <
typename T>
3474 template <
typename T, FMT_ENABLE_IF(is_builtin<T>::value)>
3476 write<Char>(out,
value);
3479 template <
typename T, FMT_ENABLE_IF(!is_builtin<T>::value)>
3487 auto format_ctx =
context(out, {}, {});
3488 h.
format(parse_ctx, format_ctx);
3497 template <
typename T, FMT_ENABLE_IF(is_builtin<T>::value)>
3502 template <
typename T, FMT_ENABLE_IF(!is_builtin<T>::value)>
3514 template <
typename T, FMT_ENABLE_IF(is_
integer<T>::value)>
3519 template <
typename T, FMT_ENABLE_IF(!is_
integer<T>::value)>
3526template <
typename Context,
typename ID>
3528 auto arg = ctx.arg(
id);
3533template <
typename Context>
3544 return static_cast<int>(
value);
3547template <
typename Context>
3554#if FMT_USE_NONTYPE_TEMPLATE_ARGS
3555template <
typename T,
typename Char,
size_t N,
3556 fmt::detail::fixed_string<Char, N> Str>
3557struct static_named_arg : view {
3558 static constexpr auto name = Str.data;
3561 static_named_arg(
const T& v) : value(v) {}
3564template <
typename T,
typename Char,
size_t N,
3565 fmt::detail::fixed_string<Char, N> Str>
3566struct is_named_arg<static_named_arg<T, Char, N, Str>> : std::true_type {};
3568template <
typename T,
typename Char,
size_t N,
3569 fmt::detail::fixed_string<Char, N> Str>
3570struct is_static_named_arg<static_named_arg<T, Char, N, Str>> : std::true_type {
3573template <
typename Char,
size_t N, fmt::detail::fixed_
string<Char, N> Str>
3575 template <
typename T>
auto operator=(T&& value)
const {
3576 return static_named_arg<T, Char, N, Str>(std::forward<T>(value));
3584 return {str, std::forward<T>(
value)};
3593 void on_text(
const Char* begin,
const Char* end) {
3594 copy_noinline<Char>(begin, end, ctx.out());
3604 int arg_id = ctx.arg_id(
id);
3617 if (
arg.format_custom(begin, parse_ctx, ctx))
return parse_ctx.
begin();
3625 specs.precision_ref, ctx);
3637 const char* message)
noexcept;
3642template <
typename T,
typename Char, type TYPE>
3643template <
typename FormatContext>
3645 const T& val, FormatContext& ctx)
const ->
decltype(ctx.out()) {
3646 if (!specs_.dynamic())
3647 return write<Char>(ctx.out(), val, specs_, ctx.locale());
3652 specs_.precision_ref, ctx);
3653 return write<Char>(ctx.out(), val, specs, ctx.locale());
3664template <
typename Char>
3668 parse_format_string(
3688 template <
typename T>
3695 : out_(out), args_(args), loc_(loc) {}
3701 return args_.
get(
id);
3705 return args_.
get(name);
3708 return args_.
get_id(name);
3725 template <
typename T, FMT_ENABLE_IF(!detail::is_
float128<T>::value)>
3728 template <
typename T, FMT_ENABLE_IF(detail::is_
float128<T>::value)>
3731 template <
typename Visitor>
auto visit(Visitor&& vis) ->
decltype(vis(0)) {
3732 return value_.
visit(vis);
3740 std::string separator_;
3741 std::string grouping_;
3742 std::string decimal_point_;
3753 std::string decimal_point =
".")
3754 : separator_(sep.data(), sep.size()),
3755 grouping_(grouping),
3756 decimal_point_(decimal_point) {}
3760 return do_put(out, val, specs);
3764#define FMT_FORMAT_AS(Type, Base) \
3765 template <typename Char> \
3766 struct formatter<Type, Char> : formatter<Base, Char> { \
3767 template <typename FormatContext> \
3768 FMT_CONSTEXPR auto format(Type value, FormatContext& ctx) const \
3769 -> decltype(ctx.out()) { \
3770 return formatter<Base, Char>::format(value, ctx); \
3785template <
typename Char,
size_t N>
3788template <
typename Char,
typename Traits,
typename Allocator>
3790 :
public formatter<basic_string_view<Char>, Char> {};
3792template <
int N,
typename Char>
3794template <
int N,
typename Char>
3796 :
formatter<unsigned long long, Char> {};
3798template <
typename Char>
3801 detail::type::float_type> {};
3803template <
typename T,
typename Char>
3805 :
formatter<detail::format_as_result<T>, Char> {
3806 template <
typename FormatContext>
3808 ->
decltype(ctx.out()) {
3821template <
typename T>
auto ptr(T p) ->
const void* {
3822 static_assert(std::is_pointer<T>::value,
"");
3834template <
typename Enum>
3840template <
typename Enum, FMT_ENABLE_IF(std::is_enum<Enum>::value)>
3846#ifdef __cpp_lib_byte
3848 static auto format_as(std::byte b) ->
unsigned char {
3849 return static_cast<unsigned char>(
b);
3851 template <
typename Context>
3852 auto format(std::byte b, Context& ctx)
const ->
decltype(ctx.out()) {
3870 return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx,
3874 template <
typename FormatContext>
3875 auto format(
bytes b, FormatContext& ctx)
const ->
decltype(ctx.out()) {
3876 auto specs = specs_;
3878 specs.width_ref, ctx);
3880 specs.precision_ref, ctx);
3909 return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx,
3913 template <
typename FormatContext>
3915 ->
decltype(ctx.out()) {
3916 auto specs = specs_;
3918 specs.width_ref, ctx);
3920 specs.precision_ref, ctx);
3933template <
typename T,
typename Char>
3938 template <
typename FormatContext>
3940 ->
decltype(ctx.out()) {
3941 return view.fmt->format(*view.value, ctx);
3955 auto it = ctx.begin(), end = ctx.end();
3956 if (it == end)
return it;
3962 if ((c >=
'0' && c <=
'9') || c ==
'{') {
3964 width_ = specs.
width;
3967 return formatter_.parse(ctx);
3970 template <
typename FormatContext,
typename F>
3971 auto write_padded(FormatContext& ctx, F write)
const ->
decltype(ctx.out()) {
3972 if (width_ == 0)
return write(ctx.out());
3976 specs.
width = width_;
3990#if FMT_USE_NONTYPE_TEMPLATE_ARGS
3991template <detail::fixed_
string S>
constexpr auto operator""_a() {
4015 enum { buffer_size = std::numeric_limits<unsigned long long>::digits10 + 3 };
4016 mutable char buffer_[buffer_size];
4019 template <
typename UInt>
4025 template <
typename Int>
4028 bool negative = value < 0;
4029 if (negative) abs_value = 0 - abs_value;
4030 auto begin = format_unsigned(abs_value);
4031 if (negative) *--begin =
'-';
4038 : str_(format_signed(value)) {}
4040 : str_(format_signed(value)) {}
4042 : str_(format_unsigned(value)) {}
4044 : str_(format_unsigned(value)) {}
4046 : str_(format_unsigned(value)) {}
4060 buffer_[buffer_size - 1] =
'\0';
4065 inline auto str() const ->
std::
string {
return {str_,
size()}; }
4068#define FMT_STRING_IMPL(s, base) \
4072 struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \
4073 using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
4074 constexpr explicit operator fmt::basic_string_view<char_type>() const { \
4075 return fmt::detail::compile_string_to_view<char_type>(s); \
4078 using FMT_STRING_VIEW = \
4079 fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \
4080 fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \
4081 return FMT_COMPILE_STRING(); \
4092#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string)
4095 -> std::system_error;
4112template <
typename... T>
4114 -> std::system_error {
4132 const char* message)
noexcept;
4145template <
typename... T>
4147 T&&... args) -> std::string {
4151template <
typename OutputIt,
4160template <
typename OutputIt,
typename... T,
4164 return fmt::vformat_to(out, loc, fmt.str,
vargs<T...>{{args...}});
4167template <
typename... T>
4170 T&&... args) ->
size_t {
4187template <
typename... T>
4200template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
4208template <
typename T, FMT_ENABLE_IF(detail::use_format_as<T>::value)>
4213template <
typename T, FMT_ENABLE_IF(!std::is_
integral<T>::value &&
4214 !detail::use_format_as<T>::value)>
4218 return {buffer.data(), buffer.size()};
4224#ifdef FMT_HEADER_ONLY
4225# define FMT_FUNC inline
4230#ifdef FMT_REMOVE_TRANSITIVE_INCLUDES
4231# undef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
constexpr auto format_as(HAL_AddressableLEDColorOrder order)
Definition AddressableLEDTypes.h:34
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 and nanopb were all modified for use in 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:141
A dynamically growing memory buffer for trivially copyable/constructible types with the first SIZE el...
Definition format.h:790
const T & const_reference
Definition format.h:829
FMT_CONSTEXPR20 ~basic_memory_buffer()
Definition format.h:837
auto operator=(basic_memory_buffer &&other) noexcept -> basic_memory_buffer &
Moves the content of the other basic_memory_buffer object to this one.
Definition format.h:867
void reserve(size_t new_capacity)
Increases the buffer capacity to new_capacity.
Definition format.h:882
auto get_allocator() const -> Allocator
Definition format.h:875
FMT_CONSTEXPR20 void append(const ContiguousRange &range)
Definition format.h:886
FMT_CONSTEXPR basic_memory_buffer(const Allocator &alloc=Allocator())
Definition format.h:831
FMT_CONSTEXPR void resize(size_t count)
Resizes the buffer to contain count elements.
Definition format.h:879
FMT_CONSTEXPR20 basic_memory_buffer(basic_memory_buffer &&other) noexcept
Constructs a basic_memory_buffer object moving the content of the other object to it.
Definition format.h:861
T value_type
Definition format.h:828
constexpr bool dynamic() const
Definition base.h:768
FMT_CONSTEXPR void set_fill(char c)
Definition base.h:811
constexpr auto align() const -> align
Definition base.h:745
FMT_CONSTEXPR auto dynamic_precision() const -> arg_id_kind
Definition base.h:759
constexpr auto sign() const -> sign
Definition base.h:772
FMT_CONSTEXPR void set_alt()
Definition base.h:783
constexpr auto localized() const -> bool
Definition base.h:786
constexpr auto upper() const -> bool
Definition base.h:779
constexpr auto type() const -> presentation_type
Definition base.h:738
constexpr auto fill() const -> const Char *
Definition base.h:796
constexpr auto alt() const -> bool
Definition base.h:782
constexpr auto dynamic_width() const -> arg_id_kind
Definition base.h:752
constexpr auto fill_unit() const -> Char
Definition base.h:804
FMT_CONSTEXPR void set_align(fmt::align a)
Definition base.h:748
constexpr auto fill_size() const -> size_t
Definition base.h:791
An implementation of std::basic_string_view for pre-C++17.
Definition base.h:504
constexpr auto end() const noexcept -> iterator
Definition base.h:552
constexpr auto size() const noexcept -> size_t
Returns the string size.
Definition base.h:549
constexpr auto data() const noexcept -> const Char *
Returns a pointer to the string data.
Definition base.h:546
constexpr auto begin() const noexcept -> iterator
Definition base.h:551
FMT_CONSTEXPR void align(const bigint &other)
Definition format.h:2733
FMT_CONSTEXPR auto operator<<=(int shift) -> bigint &
Definition format.h:2629
FMT_CONSTEXPR20 void square()
Definition format.h:2703
FMT_CONSTEXPR bigint()
Definition format.h:2606
FMT_CONSTEXPR auto operator*=(Int value) -> bigint &
Definition format.h:2644
FMT_CONSTEXPR void operator=(Int n)
Definition format.h:2620
FMT_CONSTEXPR void assign(const bigint &other)
Definition format.h:2612
void operator=(const bigint &)=delete
bigint(uint64_t n)
Definition format.h:2607
FMT_CONSTEXPR20 void assign_pow10(int exp)
Definition format.h:2686
friend FMT_CONSTEXPR auto compare(const bigint &b1, const bigint &b2) -> int
Definition format.h:2650
FMT_CONSTEXPR auto num_bigits() const -> int
Definition format.h:2625
friend FMT_CONSTEXPR auto add_compare(const bigint &lhs1, const bigint &lhs2, const bigint &rhs) -> int
Definition format.h:2666
FMT_CONSTEXPR auto divmod_assign(const bigint &divisor) -> int
Definition format.h:2746
bigint(const bigint &)=delete
A contiguous memory buffer with an optional growing ability.
Definition base.h:1698
FMT_CONSTEXPR20 void append(const U *begin, const U *end)
Appends data to the end of the buffer.
Definition base.h:1780
FMT_CONSTEXPR void push_back(const T &value)
Definition base.h:1767
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition base.h:1740
FMT_CONSTEXPR void try_reserve(size_t new_capacity)
Definition base.h:1763
auto end() noexcept -> T *
Definition base.h:1734
FMT_CONSTEXPR void try_resize(size_t count)
Definition base.h:1754
constexpr auto capacity() const noexcept -> size_t
Returns the capacity of this buffer.
Definition base.h:1743
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data (not null-terminated).
Definition base.h:1746
auto apply(Out out, basic_string_view< C > digits) const -> Out
Definition format.h:1876
digit_grouping(locale_ref loc, bool localized=true)
Definition format.h:1856
digit_grouping(std::string grouping, std::basic_string< Char > sep)
Definition format.h:1862
auto has_separator() const -> bool
Definition format.h:1865
auto count_separators(int num_digits) const -> int
Definition format.h:1867
constexpr auto has_separator() const -> bool
Definition format.h:2451
constexpr auto count_separators(int) const -> int
Definition format.h:2453
constexpr fallback_digit_grouping(locale_ref, bool)
Definition format.h:2449
constexpr auto apply(Out out, basic_string_view< C >) const -> Out
Definition format.h:2456
static auto convert(Buffer &buf, basic_string_view< WChar > s, to_utf8_error_policy policy=to_utf8_error_policy::abort) -> bool
Definition format.h:1318
auto convert(basic_string_view< WChar > s, to_utf8_error_policy policy=to_utf8_error_policy::abort) -> bool
Definition format.h:1311
to_utf8(basic_string_view< WChar > s, to_utf8_error_policy policy=to_utf8_error_policy::abort)
Definition format.h:1295
to_utf8()
Definition format.h:1294
auto c_str() const -> const char *
Definition format.h:1305
auto size() const -> size_t
Definition format.h:1304
auto str() const -> std::string
Definition format.h:1306
FMT_CONSTEXPR auto operator>>=(int shift) -> uint128_fallback &
Definition format.h:356
constexpr uint128_fallback(uint64_t hi, uint64_t lo)
Definition format.h:290
FMT_CONSTEXPR auto operator>>(int shift) const -> uint128_fallback
Definition format.h:346
friend constexpr auto operator==(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition format.h:301
friend FMT_CONSTEXPR auto operator*(const uint128_fallback &lhs, uint32_t rhs) -> uint128_fallback
Definition format.h:334
friend constexpr auto operator|(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition format.h:313
friend constexpr auto operator-(const uint128_fallback &lhs, uint64_t rhs) -> uint128_fallback
Definition format.h:342
FMT_CONSTEXPR auto operator<<(int shift) const -> uint128_fallback
Definition format.h:351
friend constexpr auto operator!=(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition format.h:305
friend constexpr auto operator~(const uint128_fallback &n) -> uint128_fallback
Definition format.h:323
friend FMT_CONSTEXPR auto operator+(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition format.h:327
friend constexpr auto operator>(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition format.h:309
constexpr uint128_fallback(uint64_t value=0)
Definition format.h:291
constexpr auto high() const noexcept -> uint64_t
Definition format.h:293
FMT_CONSTEXPR void operator+=(uint128_fallback n)
Definition format.h:359
friend constexpr auto operator&(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition format.h:318
FMT_CONSTEXPR20 auto operator+=(uint64_t n) noexcept -> uint128_fallback &
Definition format.h:371
FMT_CONSTEXPR void operator&=(uint128_fallback n)
Definition format.h:366
constexpr auto low() const noexcept -> uint64_t
Definition format.h:294
FMT_API utf8_to_utf16(string_view s)
Definition format-inl.h:1409
auto size() const -> size_t
Definition format.h:1281
auto c_str() const -> const wchar_t *
Definition format.h:1282
auto str() const -> std::wstring
Definition format.h:1283
generic_context(const generic_context &)=delete
void operator=(const generic_context &)=delete
constexpr auto locale() const -> detail::locale_ref
Definition format.h:3717
constexpr auto out() const -> iterator
Definition format.h:3711
generic_context(generic_context &&)=default
void advance_to(iterator it)
Definition format.h:3713
@ builtin_types
Definition format.h:3690
auto arg(basic_string_view< Char > name) const -> basic_format_arg< generic_context >
Definition format.h:3703
OutputIt iterator
Definition format.h:3686
constexpr auto arg_id(basic_string_view< Char > name) const -> int
Definition format.h:3707
constexpr auto arg(int id) const -> basic_format_arg< generic_context >
Definition format.h:3700
Char char_type
Definition format.h:3685
constexpr generic_context(OutputIt out, basic_format_args< generic_context > args, detail::locale_ref loc={})
Definition format.h:3692
loc_value(T)
Definition format.h:3729
loc_value(T value)
Definition format.h:3726
auto visit(Visitor &&vis) -> decltype(vis(0))
Definition format.h:3731
Parsing context consisting of a format string range being parsed and an argument counter for automati...
Definition base.h:845
constexpr auto begin() const noexcept -> iterator
Returns an iterator to the beginning of the format string range being parsed.
Definition base.h:864
FMT_CONSTEXPR void check_arg_id(int id)
Reports an error if using the automatic argument indexing; otherwise switches to the manual indexing.
Definition base.h:888
FMT_CONSTEXPR auto next_arg_id() -> int
Reports an error if using the manual argument indexing; otherwise returns the next argument index and...
Definition base.h:876
std::string & str()
Definition format.h:933
string_buffer()
Definition format.h:930
void print(format_string< T... > fmt, T &&... args)
Formats args according to specifications in fmt and writes the output to the file.
Definition format.h:916
writer(detail::buffer< char > &buf)
Definition format.h:912
writer(FILE *f)
Definition format.h:911
FMT_API auto get_cached_power(int k) noexcept -> uint128_fallback
Definition format-inl.h:1137
auto floor_log10_pow2(int e) noexcept -> int
Definition format.h:1389
auto floor_log2_pow10(int e) noexcept -> int
Definition format.h:1395
FMT_API auto to_decimal(T x) noexcept -> decimal_fp< T >
Definition format-inl.h:1257
auto umul128_upper64(uint64_t x, uint64_t y) noexcept -> uint64_t
Definition format.h:1401
auto umul192_upper128(uint64_t x, uint128_fallback y) noexcept -> uint128_fallback
Definition format.h:1414
detail namespace with internal helper functions
Definition input_adapters.h:32
conditional_t< num_bits< T >()<=32 &&!FMT_REDUCE_INT_INSTANTIATIONS, uint32_t, conditional_t< num_bits< T >()<=64, uint64_t, uint128_t > > uint32_or_64_or_128_t
Definition format.h:994
uint128_t uintptr_t
Definition format.h:402
FMT_CONSTEXPR auto code_point_length(const Char *begin) -> int
Definition base.h:1248
auto get_iterator(Buf &buf, OutputIt) -> decltype(buf.out())
Definition base.h:2044
constexpr auto digits10< int128_opt >() noexcept -> int
Definition format.h:1128
FMT_CONSTEXPR FMT_NOINLINE auto write_int_noinline(OutputIt out, write_int_arg< T > arg, const format_specs &specs) -> OutputIt
Definition format.h:2091
FMT_CONSTEXPR20 auto isfinite(T value) -> bool
Definition format.h:2486
FMT_CONSTEXPR auto do_format_base2e(int base_bits, Char *out, UInt value, int size, bool upper=false) -> Char *
Definition format.h:1235
conditional_t< long_short, int, long long > long_type
Definition base.h:1071
FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs &specs, size_t size, size_t width, F &&f) -> OutputIt
Definition format.h:1643
constexpr auto to_ascii(Char c) -> char
Definition base.h:1242
constexpr auto fractional_part_rounding_thresholds(int index) -> uint32_t
Definition format.h:2991
FMT_CONSTEXPR20 auto bit_cast(const From &from) -> To
Definition format.h:260
FMT_CONSTEXPR auto operator*(fp x, fp y) -> fp
Definition format.h:1614
FMT_CONSTEXPR int get_dynamic_spec(arg_id_kind kind, const arg_ref< typename Context::char_type > &ref, Context &ctx)
Definition format.h:3534
FMT_CONSTEXPR auto compare(const Char *s1, const Char *s2, std::size_t n) -> int
Definition base.h:455
FMT_CONSTEXPR void ignore_unused(const T &...)
Definition base.h:348
auto decimal_point(locale_ref loc) -> Char
Definition format.h:1150
FMT_INLINE void assume(bool condition)
Definition format.h:459
constexpr auto num_bits< uint128_fallback >() -> int
Definition format.h:416
bool_constant< is_integral< T >::value &&!std::is_same< T, bool >::value && !std::is_same< T, char >::value && !std::is_same< T, wchar_t >::value > is_integer
Definition format.h:713
void(*)(detail::buffer< char > &, int, const char *) format_func
Definition format.h:3635
constexpr auto has_implicit_bit() -> bool
Definition format.h:1475
constexpr auto num_bits() -> int
Definition format.h:410
uint128_opt
Definition base.h:401
FMT_CONSTEXPR void prefix_append(unsigned &prefix, unsigned value)
Definition format.h:1898
auto is_big_endian() -> bool
Definition format.h:270
FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP &f, const format_specs &specs, sign s, locale_ref loc) -> OutputIt
Definition format.h:2343
FMT_CONSTEXPR auto write(OutputIt out, Char value, const format_specs &specs, locale_ref loc={}) -> OutputIt
Definition format.h:1824
FMT_CONSTEXPR auto count_digits_fallback(T n) -> int
Definition format.h:1025
conditional_t< FMT_USE_INT128, uint128_opt, uint128_fallback > uint128_t
Definition format.h:397
FMT_CONSTEXPR auto get_arg(Context &ctx, ID id) -> basic_format_arg< Context >
Definition format.h:3527
auto compute_width(basic_string_view< Char > s) -> size_t
Definition format.h:644
FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, const format_specs &specs={}) -> OutputIt
Definition format.h:1670
constexpr auto digits10() noexcept -> int
Definition format.h:1125
dragon
Definition format.h:2761
@ fixup
Definition format.h:2763
@ predecessor_closer
Definition format.h:2762
conditional_t< long_short, unsigned, unsigned long long > ulong_type
Definition base.h:1072
FMT_API void print(FILE *, string_view)
constexpr auto digits10< uint128_t >() noexcept -> int
Definition format.h:1129
FMT_CONSTEXPR20 void adjust_precision(int &precision, int exp10)
Definition format.h:2512
constexpr auto max_value() -> T
Definition format.h:407
typename std::enable_if< B, T >::type enable_if_t
Definition cpp_future.h:38
int128_opt
Definition base.h:400
FMT_CONSTEXPR auto make_write_int_arg(T value, sign s) -> write_int_arg< uint32_or_64_or_128_t< T > >
Definition format.h:1969
@ value
the parser finished reading a JSON value
FMT_CONSTEXPR auto to_unsigned(Int value) -> make_unsigned_t< Int >
Definition base.h:422
FMT_END_EXPORT auto equal2(const Char *lhs, const char *rhs) -> bool
Definition format.h:1169
constexpr FMT_INLINE_VARIABLE uint32_t invalid_code_point
Definition format.h:604
auto write_ptr(OutputIt out, UIntPtr value, const format_specs *specs) -> OutputIt
Definition format.h:1680
auto write_int(OutputIt out, UInt value, unsigned prefix, const format_specs &specs, const digit_grouping< Char > &grouping) -> OutputIt
Definition format.h:1905
auto base_iterator(OutputIt it, typename OutputIt::container_type::value_type *) -> OutputIt
Definition format.h:518
FMT_API auto decimal_point_impl(locale_ref loc) -> Char
Definition format-inl.h:117
FMT_CONSTEXPR auto check_char_specs(const format_specs &specs) -> bool
Definition base.h:1611
FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP &f, const format_specs &specs, sign s, locale_ref loc) -> OutputIt
Definition format.h:2462
constexpr auto to_pointer(OutputIt, size_t) -> T *
Definition format.h:502
auto write_loc(OutputIt, const loc_value &, const format_specs &, locale_ref) -> bool
Definition format.h:1958
to_utf8_error_policy
Definition format.h:1286
FMT_API void format_error_code(buffer< char > &out, int error_code, string_view message) noexcept
Definition format-inl.h:43
auto digits2(size_t value) -> const char *
Definition format.h:1008
conditional_t< std::is_same< T, float >::value||doublish, double, T > convert_float_result
Definition format.h:1619
FMT_CONSTEXPR auto multiply(uint64_t lhs, uint64_t rhs) -> uint64_t
Definition format.h:1597
FMT_API auto is_printable(uint32_t cp) -> bool
Definition format-inl.h:1793
FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, buffer< char > &buf)
Definition format.h:2906
FMT_CONSTEXPR FMT_NOINLINE auto copy_noinline(InputIt begin, InputIt end, OutputIt out) -> OutputIt
Definition format.h:545
constexpr auto is_constant_evaluated(bool default_value=false) noexcept -> bool
Definition base.h:350
FMT_API auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result< Char >
Definition format-inl.h:110
template FMT_API auto thousands_sep_impl< wchar_t >(locale_ref) -> thousands_sep_result< wchar_t >
@ error
throw a parse_error exception in case of a tag
auto write_escaped_char(OutputIt out, Char v) -> OutputIt
Definition format.h:1798
constexpr auto num_bits< int128_opt >() -> int
Definition format.h:414
auto thousands_sep(locale_ref loc) -> thousands_sep_result< Char >
Definition format.h:1139
FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T &value) -> OutputIt
Definition format.h:532
@ use_utf8
Definition base.h:442
FMT_ALWAYS_INLINE constexpr auto const_check(T val) -> T
Definition base.h:367
constexpr auto exponent_bias() -> int
Definition format.h:1496
constexpr auto num_significand_bits() -> int
Definition format.h:1482
FMT_CONSTEXPR auto parse_width(const Char *begin, const Char *end, format_specs &specs, arg_ref< Char > &width_ref, parse_context< Char > &ctx) -> const Char *
Definition base.h:1378
bool_constant< std::is_same< T, int >::value||FMT_BUILTIN_TYPES > is_builtin
Definition format.h:3462
FMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, const basic_specs &specs) -> OutputIt
Definition format.h:1628
FMT_API auto write_console(int fd, string_view text) -> bool
Definition format-inl.h:1694
FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt
Definition base.h:1992
bool_constant< std::is_floating_point< T >::value||is_float128< T >::value > is_floating_point
Definition format.h:737
remove_reference_t< decltype(reserve(std::declval< OutputIt & >(), 0))> reserve_iterator
Definition format.h:498
FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt
Definition format.h:1504
FMT_CONSTEXPR auto utf8_decode(const char *s, uint32_t *c, int *e) -> const char *
Definition format.h:567
FMT_CONSTEXPR void abort_fuzzing_if(bool condition)
Definition format.h:234
constexpr auto getsign(sign s) -> Char
Definition format.h:1020
std::integral_constant< bool, std::numeric_limits< T >::is_signed|| std::is_same< T, int128_opt >::value > is_signed
Definition format.h:708
FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, format_specs specs, sign s) -> OutputIt
Definition format.h:2220
constexpr auto write_significand(OutputIt out, const char *significand, int significand_size) -> OutputIt
Definition format.h:2254
auto write_escaped_cp(OutputIt out, const find_escape_result< Char > &escape) -> OutputIt
Definition format.h:1745
FMT_CONSTEXPR auto parse_align(const Char *begin, const Char *end, format_specs &specs) -> const Char *
Definition format.h:2184
constexpr auto get_significand_size(const big_decimal_fp &f) -> int
Definition format.h:2245
FMT_CONSTEXPR auto format_base2e(int base_bits, Char *out, UInt value, int num_digits, bool upper=false) -> Char *
Definition format.h:1249
FMT_CONSTEXPR auto write_char(OutputIt out, Char value, const format_specs &specs) -> OutputIt
Definition format.h:1814
auto needs_escape(uint32_t cp) -> bool
Definition format.h:1696
constexpr auto convert_float(T value) -> convert_float_result< T >
Definition format.h:1623
auto write_codepoint(OutputIt out, char prefix, uint32_t cp) -> OutputIt
Definition format.h:1735
auto code_point_index(basic_string_view< Char > s, size_t n) -> size_t
Definition format.h:684
typename V::value_type char_t
String's character (code unit) type. detail:: is intentional to prevent ADL.
Definition base.h:935
constexpr auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition base.h:910
FMT_CONSTEXPR void handle_dynamic_spec(arg_id_kind kind, int &value, const arg_ref< typename Context::char_type > &ref, Context &ctx)
Definition format.h:3548
std::integral_constant< bool, Value > bool_constant
Definition type_traits.h:743
conditional_t< num_bits< T >()<=64, uint64_t, uint128_t > uint64_or_128_t
Definition format.h:999
state
Definition base.h:1402
FMT_CONSTEXPR void for_each_codepoint(string_view s, F f)
Definition format.h:609
FMT_CONSTEXPR20 auto reserve(OutputIt it, size_t n) -> typename OutputIt::value_type *
Definition format.h:477
FMT_EXPORT constexpr auto compile_string_to_view(const Char(&s)[N]) -> basic_string_view< Char >
Definition format.h:968
FMT_CONSTEXPR20 auto countl_zero_fallback(UInt n) -> int
Definition format.h:438
constexpr auto is_negative(T value) -> bool
Definition format.h:983
std::is_same< T, float128 > is_float128
Definition format.h:734
FMT_API void do_report_error(format_func func, int error_code, const char *message) noexcept
Definition format-inl.h:66
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
Definition base.h:2034
auto find_escape(const Char *begin, const Char *end) -> find_escape_result< Char >
Definition format.h:1709
FMT_CONSTEXPR20 auto format_float(Float value, int precision, const format_specs &specs, bool binary32, buffer< char > &buf) -> int
Definition format.h:3003
FMT_CONSTEXPR20 FMT_INLINE void write2digits(Char *out, size_t value)
Definition format.h:1178
constexpr auto num_bits< uint128_opt >() -> int
Definition format.h:415
constexpr auto count() -> int
Definition base.h:1028
FMT_CONSTEXPR20 auto do_format_decimal(Char *out, UInt value, int size) -> Char *
Definition format.h:1191
FMT_CONSTEXPR20 auto count_digits(uint64_t n) -> int
Definition format.h:1068
void vformat_to(buffer< Char > &buf, basic_string_view< Char > fmt, typename vformat_args< Char >::type args, locale_ref loc={})
Definition format.h:3665
FMT_BEGIN_EXPORT template FMT_API auto thousands_sep_impl< char >(locale_ref) -> thousands_sep_result< char >
conditional_t< sizeof(Char)==1, unsigned char, unsigned > unsigned_char
Definition base.h:428
constexpr auto exponent_mask() -> typename dragonbox::float_info< Float >::carrier_uint
Definition format.h:1490
FMT_CONSTEXPR FMT_INLINE auto format_decimal(Char *out, UInt value, int num_digits) -> Char *
Definition format.h:1213
FMT_CONSTEXPR20 auto countl_zero(uint32_t n) -> int
Definition format.h:445
StringType escape(StringType s)
string escaping as described in RFC 6901 (Sect. 4)
Definition string_escape.h:50
FMT_CONSTEXPR20 void format_dragon(basic_fp< uint128_t > value, unsigned flags, int num_digits, buffer< char > &buf, int &exp10)
Definition format.h:2770
auto write_escaped_string(OutputIt out, basic_string_view< Char > str) -> OutputIt
Definition format.h:1782
auto umul128(uint64_t x, uint64_t y) noexcept -> uint128_fallback
Definition format.h:1358
FMT_CONSTEXPR20 auto get_container(OutputIt it) -> typename OutputIt::container_type &
Definition base.h:484
FMT_CONSTEXPR auto normalize(basic_fp< F > value) -> basic_fp< F >
Definition format.h:1580
FMT_CONSTEXPR auto parse_format_specs(const Char *begin, const Char *end, dynamic_format_specs< Char > &specs, parse_context< Char > &ctx, type arg_type) -> const Char *
Definition base.h:1406
constexpr auto isnan(T value) -> bool
Definition format.h:2473
FMT_INLINE FMT_CONSTEXPR bool signbit(T value)
Definition format.h:2500
constexpr auto format_as(Enum e) noexcept -> underlying_t< Enum >
Definition format.h:3841
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
bytes(string_view s)
Definition format.h:3861
string_view data
Definition format.h:3859
FMT_CONSTEXPR basic_fp(Float n)
Definition format.h:1541
constexpr basic_fp(uint64_t f_val, int e_val)
Definition format.h:1538
FMT_CONSTEXPR auto assign(Float n) -> bool
Definition format.h:1545
constexpr basic_fp()
Definition format.h:1537
int e
Definition format.h:1532
static constexpr const int num_significand_bits
Definition format.h:1534
F f
Definition format.h:1531
const char * significand
Definition format.h:2240
int significand_size
Definition format.h:2241
int exponent
Definition format.h:2242
int exponent
Definition format.h:1468
significand_type significand
Definition format.h:1467
typename float_info< T >::carrier_uint significand_type
Definition format.h:1466
detail::uint128_t carrier_uint
Definition format.h:1462
detail::uint128_t carrier_uint
Definition format.h:1455
uint64_t carrier_uint
Definition format.h:1439
uint32_t carrier_uint
Definition format.h:1427
FMT_CONSTEXPR auto operator()(T) -> unsigned long long
Definition format.h:3520
FMT_CONSTEXPR auto operator()(T value) -> unsigned long long
Definition format.h:3515
const Char * end
Definition format.h:1704
const Char * begin
Definition format.h:1703
uint32_t cp
Definition format.h:1705
Char data[N]
Definition format.h:963
FMT_CONSTEXPR20 fixed_string(const Char(&s)[N])
Definition format.h:959
std::string grouping
Definition format.h:1988
auto operator()(T value) -> bool
Definition format.h:1992
auto operator()(T) -> bool
Definition format.h:2000
std::basic_string< Char > decimal_point
Definition format.h:1989
const format_specs & specs
Definition format.h:1986
std::basic_string< Char > sep
Definition format.h:1987
basic_appender< Char > out
Definition format.h:1985
Definition format-inl.h:92
FMT_CONSTEXPR size_padding(int num_digits, unsigned prefix, const format_specs &specs)
Definition format.h:2010
unsigned padding
Definition format.h:2008
unsigned size
Definition format.h:2007
static constexpr Char value[sizeof...(C)]
Definition format.h:248
Char thousands_sep
Definition format.h:1133
std::string grouping
Definition format.h:1132
const Char * str
Definition format.h:3581
auto operator=(T &&value) const -> named_arg< Char, T >
Definition format.h:3583
unsigned prefix
Definition format.h:1965
UInt abs_value
Definition format.h:1964
T value
Definition format.h:3887
const T * value
Definition format.h:3930
const formatter< T, Char > * fmt
Definition format.h:3929
void pointer
Definition format.h:126
void reference
Definition format.h:127
output_iterator_tag iterator_category
Definition format.h:122
decltype(static_cast< int * >(nullptr) - static_cast< int * >(nullptr)) difference_type
Definition format.h:124
T value_type
Definition format.h:123
int index
Definition base.h:1228
basic_string_view< Char > name
Definition base.h:1229
#define S(label, offset, message)
Definition Errors.h:113
#define FMT_ASSERT(condition, message)
Definition base.h:381
#define FMT_END_EXPORT
Definition base.h:250
#define FMT_BUILTIN_TYPES
Definition base.h:279
#define FMT_PRAGMA_CLANG(x)
Definition base.h:230
basic_string_view< char > string_view
Definition base.h:603
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Returns a named argument to be used in a formatting function.
Definition base.h:2775
constexpr auto min_of(T a, T b) -> T
Definition base.h:337
#define FMT_FALLTHROUGH
Definition base.h:172
#define FMT_NODISCARD
Definition base.h:187
typename std::remove_reference< T >::type remove_reference_t
Definition base.h:302
typename fstring< T... >::t format_string
Definition base.h:2720
#define FMT_GCC_VERSION
Definition base.h:35
#define FMT_OPTIMIZE_SIZE
Definition base.h:273
basic_appender< char > appender
Definition base.h:619
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
Definition base.h:306
constexpr auto max_of(T a, T b) -> T
Definition base.h:340
#define FMT_CONSTEXPR
Definition base.h:113
align
Definition base.h:684
arg_id_kind
Definition base.h:686
#define FMT_BEGIN_NAMESPACE
Definition base.h:239
sign
Definition base.h:685
conditional_t< std::is_same< OutputIt, appender >::value, context, generic_context< OutputIt, Char > > basic_format_context
Definition base.h:632
#define FMT_API
Definition base.h:269
#define FMT_ENABLE_IF(...)
Definition base.h:334
#define FMT_BEGIN_EXPORT
Definition base.h:249
void void_t
Definition base.h:321
#define FMT_INLINE
Definition base.h:209
basic_format_args< context > format_args
Definition base.h:647
#define FMT_NORETURN
Definition base.h:179
#define FMT_MSC_WARNING(...)
Definition base.h:235
typename std::conditional< B, T, F >::type conditional_t
Definition base.h:299
#define FMT_CONSTEXPR20
Definition base.h:141
typename std::underlying_type< T >::type underlying_t
Definition base.h:310
#define FMT_END_NAMESPACE
Definition base.h:242
conditional_t< std::is_same< Char, char >::value, context, generic_context< basic_appender< Char >, Char > > buffered_context
Definition base.h:638
#define FMT_EXPORT
Definition base.h:248