36#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
37# define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
38# define FMT_REMOVE_TRANSITIVE_INCLUDES
44#if FMT_HAS_INCLUDE(<string_view>) && \
45 (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION))
46# define FMT_USE_STRING_VIEW
58# if defined(__GLIBCXX__) && !defined(_GLIBCXX_USE_DUAL_ABI)
64# include <system_error>
67# if FMT_HAS_INCLUDE(<bit>) && FMT_CPLUSPLUS > 201703L
71# if defined(FMT_USE_STRING_VIEW)
72# include <string_view>
80#if defined(FMT_USE_NONTYPE_TEMPLATE_ARGS)
82#elif defined(__NVCOMPILER)
83# define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
84#elif FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L
85# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
86#elif defined(__cpp_nontype_template_args) && \
87 __cpp_nontype_template_args >= 201911L
88# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
89#elif FMT_CLANG_VERSION >= 1200 && FMT_CPLUSPLUS >= 202002L
90# define FMT_USE_NONTYPE_TEMPLATE_ARGS 1
92# define FMT_USE_NONTYPE_TEMPLATE_ARGS 0
95#if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L
96# define FMT_INLINE_VARIABLE inline
98# define FMT_INLINE_VARIABLE
104#elif defined(__GXX_RTTI) || FMT_HAS_FEATURE(cxx_rtti) || defined(_CPPRTTI) || \
105 defined(__INTEL_RTTI__) || defined(__RTTI)
107# define FMT_USE_RTTI 1
109# define FMT_USE_RTTI 0
113#if defined(FMT_LIB_EXPORT) || defined(FMT_SHARED)
114# define FMT_SO_VISIBILITY(value) FMT_VISIBILITY(value)
116# define FMT_SO_VISIBILITY(value)
119#if FMT_GCC_VERSION || FMT_CLANG_VERSION
120# define FMT_NOINLINE __attribute__((noinline))
127#elif FMT_HAS_CPP14_ATTRIBUTE(deprecated)
128# define FMT_DEPRECATED [[deprecated]]
130# define FMT_DEPRECATED
134#if !FMT_USE_CONSTEVAL
135# define FMT_USE_CONSTEXPR_STRING 0
136#elif defined(__cpp_lib_constexpr_string) && \
137 __cpp_lib_constexpr_string >= 201907L
138# if FMT_CLANG_VERSION && FMT_GLIBCXX_RELEASE
141# if FMT_GLIBCXX_RELEASE < 13
142# define FMT_USE_CONSTEXPR_STRING 0
143# elif FMT_GLIBCXX_RELEASE == 13 && __GLIBCXX__ < 20240521
144# define FMT_USE_CONSTEXPR_STRING 0
146# define FMT_USE_CONSTEXPR_STRING 1
149# define FMT_USE_CONSTEXPR_STRING 1
152# define FMT_USE_CONSTEXPR_STRING 0
154#if FMT_USE_CONSTEXPR_STRING
155# define FMT_CONSTEXPR_STRING constexpr
157# define FMT_CONSTEXPR_STRING
166 decltype(
static_cast<int*
>(
nullptr) -
static_cast<int*
>(
nullptr));
174#elif FMT_USE_EXCEPTIONS
175# define FMT_THROW(x) throw x
177# define FMT_THROW(x) ::fmt::assert_fail(__FILE__, __LINE__, (x).what())
180#ifdef __clang_analyzer__
181# define FMT_CLANG_ANALYZER 1
183# define FMT_CLANG_ANALYZER 0
190#if !defined(FMT_REDUCE_INT_INSTANTIATIONS)
191# define FMT_REDUCE_INT_INSTANTIATIONS 0
196template <
typename Char,
typename Traits,
typename Allocator>
205# if FMT_HAS_BUILTIN(__builtin_clz) || FMT_GCC_VERSION || FMT_ICC_VERSION
206# define FMT_BUILTIN_CLZ(n) __builtin_clz(n)
208# if FMT_HAS_BUILTIN(__builtin_clzll) || FMT_GCC_VERSION || FMT_ICC_VERSION
209# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
216#if FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL)
219# pragma intrinsic(_BitScanReverse)
221# pragma intrinsic(_BitScanReverse64)
225inline auto clz(uint32_t x) ->
int {
229 _BitScanReverse(&r, x);
230 return 31 ^
static_cast<int>(r);
232# define FMT_BUILTIN_CLZ(n) detail::clz(n)
234inline auto clzll(uint64_t x) ->
int {
239 _BitScanReverse64(&r, x);
242 if (_BitScanReverse(&r,
static_cast<uint32_t
>(x >> 32)))
243 return 63 ^
static_cast<int>(r + 32);
245 _BitScanReverse(&r,
static_cast<uint32_t
>(x));
247 return 63 ^
static_cast<int>(r);
249# define FMT_BUILTIN_CLZLL(n) detail::clzll(n)
255 if (condition)
throw std::runtime_error(
"fuzzing limit reached");
259#if defined(FMT_USE_STRING_VIEW)
260template <
typename Char>
using std_string_view = std::basic_string_view<Char>;
268 static constexpr Char
value[
sizeof...(C)] = {C...};
270 return {
value,
sizeof...(C)};
273#if FMT_CPLUSPLUS < 201703L
274template <
typename Char, Char... C>
279template <
typename To,
typename From, FMT_ENABLE_IF(sizeof(To) == sizeof(From))>
281#ifdef __cpp_lib_bit_cast
286 std::memcpy(
static_cast<void*
>(&to), &
from,
sizeof(to));
293#elif defined(__BIG_ENDIAN__)
295#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
296 return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__;
299 char data[
sizeof(int)];
313 constexpr auto high() const noexcept -> uint64_t {
return hi_; }
314 constexpr auto low() const noexcept -> uint64_t {
return lo_; }
316 template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
317 constexpr explicit operator T()
const {
318 return static_cast<T
>(lo_);
323 return lhs.hi_ == rhs.hi_ && lhs.lo_ == rhs.lo_;
327 return !(lhs == rhs);
331 return lhs.hi_ != rhs.hi_ ? lhs.hi_ > rhs.hi_ : lhs.lo_ > rhs.lo_;
336 return {lhs.hi_ | rhs.hi_, lhs.lo_ | rhs.lo_};
341 return {lhs.hi_ & rhs.hi_, lhs.lo_ & rhs.lo_};
345 return {~n.hi_, ~n.lo_};
357 uint64_t hi = (lhs.lo_ >> 32) * rhs;
358 uint64_t lo = (lhs.lo_ & ~uint32_t()) * rhs;
359 uint64_t new_lo = (hi << 32) + lo;
360 return {(hi >> 32) + (new_lo < lo ? 1 : 0), new_lo};
364 return {lhs.hi_ - (lhs.lo_ < rhs ? 1 : 0), lhs.lo_ - rhs};
367 if (shift == 64)
return {0, hi_};
369 return {hi_ >> shift, (hi_ << (64 - shift)) | (lo_ >> shift)};
372 if (shift == 64)
return {lo_, 0};
374 return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)};
377 return *
this = *
this >> shift;
380 uint64_t new_lo = lo_ + n.lo_;
381 uint64_t new_hi = hi_ + n.hi_ + (new_lo < lo_ ? 1 : 0);
394 hi_ += (lo_ < n ? 1 : 0);
397#if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__)
398 unsigned long long carry;
399 lo_ = __builtin_addcll(lo_, n, 0, &carry);
401#elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__)
402 unsigned long long result;
403 auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &result);
406#elif defined(_MSC_VER) && defined(_M_X64)
407 auto carry = _addcarry_u64(0, lo_, n, &lo_);
408 _addcarry_u64(carry, hi_, 0, &hi_);
411 hi_ += (lo_ < n ? 1 : 0);
428 return (std::numeric_limits<T>::max)();
430template <
typename T>
constexpr auto num_bits() ->
int {
431 return std::numeric_limits<T>::digits;
440template <
typename To,
typename From, FMT_ENABLE_IF(sizeof(To) >
sizeof(From))>
442 constexpr auto size =
static_cast<int>(
sizeof(From) /
sizeof(
unsigned short));
444 unsigned short value[
static_cast<unsigned>(size)];
448 for (
int i = 0; i < size; ++i)
451 for (
int i = size - 1; i >= 0; --i)
457template <
typename UInt>
460 constexpr UInt msb_mask =
static_cast<UInt
>(1) << (
num_bits<UInt>() - 1);
461 for (; (n & msb_mask) == 0; n <<= 1) lz++;
466#ifdef FMT_BUILTIN_CLZ
473#ifdef FMT_BUILTIN_CLZLL
481#if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION
482 __builtin_assume(condition);
484 if (!condition) __builtin_unreachable();
490template <
typename OutputIt,
493#if FMT_CLANG_VERSION >= 307 && !FMT_ICC_VERSION
494__attribute__((no_sanitize(
"undefined")))
497reserve(OutputIt it,
size_t n) ->
typename OutputIt::value_type* {
499 size_t size = c.size();
512template <
typename Iterator>
513constexpr auto reserve(Iterator& it,
size_t) -> Iterator& {
517template <
typename OutputIt>
521template <
typename T,
typename OutputIt>
534 auto size = buf.
size();
535 if (buf.
capacity() < size + n)
return nullptr;
537 return buf.
data() + size;
540template <
typename OutputIt,
544 typename OutputIt::container_type::value_type*)
549template <
typename Iterator>
556template <
typename OutputIt,
typename Size,
typename T>
559 for (Size i = 0; i <
count; ++i) *out++ =
value;
562template <
typename T,
typename Size>
565 static_assert(
sizeof(T) == 1,
566 "sizeof(T) must be 1 to use char for initialization");
571template <
typename OutChar,
typename InputIt,
typename OutputIt>
573 OutputIt out) -> OutputIt {
596 constexpr int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07};
597 constexpr uint32_t mins[] = {4194304, 0, 128, 2048, 65536};
598 constexpr int shiftc[] = {0, 18, 12, 6, 0};
599 constexpr int shifte[] = {0, 6, 4, 2, 0};
601 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"
602 [
static_cast<unsigned char>(*s) >> 3];
606 const char* next = s + len + !len;
608 using uchar =
unsigned char;
612 *c = uint32_t(uchar(s[0]) & masks[len]) << 18;
613 *c |= uint32_t(uchar(s[1]) & 0x3f) << 12;
614 *c |= uint32_t(uchar(s[2]) & 0x3f) << 6;
615 *c |= uint32_t(uchar(s[3]) & 0x3f) << 0;
619 *e = (*c < mins[len]) << 6;
620 *e |= ((*c >> 11) == 0x1b) << 7;
621 *e |= (*c > 0x10FFFF) << 8;
622 *e |= (uchar(s[1]) & 0xc0) >> 2;
623 *e |= (uchar(s[2]) & 0xc0) >> 4;
624 *e |= uchar(s[3]) >> 6;
637 auto decode = [f](
const char* buf_ptr,
const char*
ptr) {
638 auto cp = uint32_t();
643 return result ? (error ? buf_ptr + 1 : end) :
nullptr;
647 const size_t block_size = 4;
648 if (s.
size() >= block_size) {
649 for (
auto end =
p + s.
size() - block_size + 1;
p < end;) {
655 if (num_chars_left == 0)
return;
659 char buf[2 * block_size - 1] = {};
661 const char* buf_ptr = buf;
663 auto end = decode(buf_ptr,
p);
667 }
while (buf_ptr < buf + num_chars_left);
677 (cp >= 0x2e80 && cp <= 0xa4cf && cp != 0x303f) ||
678 (cp >= 0xac00 && cp <= 0xd7a3) ||
679 (cp >= 0xf900 && cp <= 0xfaff) ||
680 (cp >= 0xfe10 && cp <= 0xfe19) ||
681 (cp >= 0xfe30 && cp <= 0xfe6f) ||
682 (cp >= 0xff00 && cp <= 0xff60) ||
683 (cp >= 0xffe0 && cp <= 0xffe6) ||
684 (cp >= 0x20000 && cp <= 0x2fffd) ||
685 (cp >= 0x30000 && cp <= 0x3fffd) ||
687 (cp >= 0x1f300 && cp <= 0x1f64f) ||
689 (cp >= 0x1f900 && cp <= 0x1f9ff))));
698 std::integral_constant<bool, std::numeric_limits<T>::is_signed ||
699 std::is_same<T, int128_opt>::value>;
704 !std::is_same<T, char>::value &&
705 !std::is_same<T, wchar_t>::value>;
707#if defined(FMT_USE_FLOAT128)
709#elif FMT_CLANG_VERSION >= 309 && FMT_HAS_INCLUDE(<quadmath.h>)
710# define FMT_USE_FLOAT128 1
711#elif FMT_GCC_VERSION && defined(_GLIBCXX_USE_FLOAT128) && \
712 !defined(__STRICT_ANSI__)
713# define FMT_USE_FLOAT128 1
715# define FMT_USE_FLOAT128 0
718using float128 = __float128;
723template <
typename T>
using is_float128 = std::is_same<T, float128>;
728template <typename T, bool = is_floating_point<T>::value>
730 sizeof(T) <= sizeof(double)> {};
731template <typename T> struct is_fast_float<T, false> : std::false_type {};
734using fast_float_t = conditional_t<sizeof(T) == sizeof(double), double, float>;
737using is_double_double = bool_constant<std::numeric_limits<T>::digits == 106>;
739#ifndef FMT_USE_FULL_CACHE_DRAGONBOX
740# define FMT_USE_FULL_CACHE_DRAGONBOX 0
746template <typename T> struct allocator : private std::decay<void> {
747 using value_type = T;
749 auto allocate(size_t n) -> T* {
751 T*
p =
static_cast<T*
>(malloc(n *
sizeof(T)));
758 constexpr friend auto operator==(allocator, allocator)
noexcept ->
bool {
761 constexpr friend auto operator!=(allocator, allocator)
noexcept ->
bool {
766template <
typename Formatter>
768 ->
decltype(f.set_debug_format(
set)) {
769 f.set_debug_format(
set);
771template <
typename Formatter>
796 typename Allocator = detail::allocator<T>>
807 if (data != store_) alloc_.deallocate(
data, this->
capacity());
813 const size_t max_size =
814 std::allocator_traits<Allocator>::max_size(self.alloc_);
815 size_t old_capacity = buf.
capacity();
816 size_t new_capacity = old_capacity + old_capacity / 2;
817 if (
size > new_capacity)
819 else if (new_capacity > max_size)
821 T* old_data = buf.
data();
822 T* new_data = self.alloc_.allocate(new_capacity);
826 memcpy(new_data, old_data, buf.
size() *
sizeof(T));
827 self.set(new_data, new_capacity);
831 if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity);
839 const Allocator& alloc = Allocator())
841 this->
set(store_, SIZE);
847 template <
typename Alloc = Allocator,
849 propagate_on_container_move_assignment::value)>
851 alloc_ = std::move(other.alloc_);
855 template <
typename Alloc = Allocator,
857 propagate_on_container_move_assignment::value)>
859 T*
data = other.data();
860 if (alloc_ == other.alloc_ ||
data == other.store_)
return true;
861 size_t size = other.size();
872 if (!move_alloc(other))
return;
873 if (
data == other.store_) {
880 other.
set(other.store_, 0);
913 template <
typename ContiguousRange>
915 append(range.data(), range.data() + range.size());
921template <
size_t SIZE>
924 auto size = buf.
size();
926 return {buf.
data(), size};
939 inline writer(FILE* f) : buf_(nullptr), file_(f) {}
946 fmt::format_to(
appender(*buf_), fmt, std::forward<T>(args)...);
948 fmt::print(file_, fmt, std::forward<T>(args)...);
960 inline operator writer() {
return buf_; }
961 inline auto str() -> std::string& {
return str_; }
964template <
typename T,
size_t SIZE,
typename Allocator>
974 using std::runtime_error::runtime_error;
1000 return {s, N - (std::char_traits<Char>::to_int_type(s[N - 1]) == 0 ? 1 : 0)};
1010template <
typename T, FMT_ENABLE_IF(is_
signed<T>::value)>
1014template <
typename T, FMT_ENABLE_IF(!is_
signed<T>::value)>
1021template <
typename T>
1026template <
typename T>
1029#define FMT_POWERS_OF_10(factor) \
1030 factor * 10, (factor) * 100, (factor) * 1000, (factor) * 10000, \
1031 (factor) * 100000, (factor) * 1000000, (factor) * 10000000, \
1032 (factor) * 100000000, (factor) * 1000000000
1039 alignas(2)
static const char data[] =
1040 "0001020304050607080910111213141516171819"
1041 "2021222324252627282930313233343536373839"
1042 "4041424344454647484950515253545556575859"
1043 "6061626364656667686970717273747576777879"
1044 "8081828384858687888990919293949596979899";
1045 return &data[
value * 2];
1049 return static_cast<char>(((
' ' << 24) | (
'+' << 16) | (
'-' << 8)) >>
1050 (
static_cast<int>(s) * 8));
1059 if (n < 10)
return count;
1060 if (n < 100)
return count + 1;
1061 if (n < 1000)
return count + 2;
1062 if (n < 10000)
return count + 3;
1073#ifdef FMT_BUILTIN_CLZLL
1076inline auto do_count_digits(uint64_t n) ->
int {
1081 static constexpr uint8_t bsr2log10[] = {
1082 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5,
1083 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10,
1084 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,
1085 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20};
1086 auto t = bsr2log10[FMT_BUILTIN_CLZLL(n | 1) ^ 63];
1087 static constexpr uint64_t zero_or_powers_of_10[] = {
1089 10000000000000000000ULL};
1090 return t - (n < zero_or_powers_of_10[t]);
1097#ifdef FMT_BUILTIN_CLZLL
1104template <
int BITS,
typename UInt>
1106#ifdef FMT_BUILTIN_CLZ
1108 return (FMT_BUILTIN_CLZ(
static_cast<uint32_t
>(n) | 1) ^ 31) / BITS + 1;
1115 }
while ((m >>= BITS) != 0);
1120#ifdef FMT_BUILTIN_CLZ
1123FMT_INLINE auto do_count_digits(uint32_t n) ->
int {
1126# define FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T)
1127 static constexpr uint64_t table[] = {
1128 FMT_INC(0), FMT_INC(0), FMT_INC(0),
1129 FMT_INC(10), FMT_INC(10), FMT_INC(10),
1130 FMT_INC(100), FMT_INC(100), FMT_INC(100),
1131 FMT_INC(1000), FMT_INC(1000), FMT_INC(1000),
1132 FMT_INC(10000), FMT_INC(10000), FMT_INC(10000),
1133 FMT_INC(100000), FMT_INC(100000), FMT_INC(100000),
1134 FMT_INC(1000000), FMT_INC(1000000), FMT_INC(1000000),
1135 FMT_INC(10000000), FMT_INC(10000000), FMT_INC(10000000),
1136 FMT_INC(100000000), FMT_INC(100000000), FMT_INC(100000000),
1137 FMT_INC(1000000000), FMT_INC(1000000000), FMT_INC(1000000000),
1138 FMT_INC(1000000000), FMT_INC(1000000000)
1140 auto inc = table[FMT_BUILTIN_CLZ(n | 1) ^ 31];
1141 return static_cast<int>((n + inc) >> 32);
1147#ifdef FMT_BUILTIN_CLZ
1153template <
typename Int>
constexpr auto digits10() noexcept ->
int {
1154 return std::numeric_limits<Int>::digits10;
1164template <
typename Char>
1166template <
typename Char>
1169 return {result.grouping, Char(result.thousands_sep)};
1176template <
typename Char>
1185#ifndef FMT_HEADER_ONLY
1197template <
typename Char>
auto equal2(
const Char* lhs,
const char* rhs) ->
bool {
1198 return lhs[0] == Char(rhs[0]) && lhs[1] == Char(rhs[1]);
1200inline auto equal2(
const char* lhs,
const char* rhs) ->
bool {
1201 return memcmp(lhs, rhs, 2) == 0;
1205template <
typename Char>
1212 *out++ =
static_cast<Char
>(
'0' +
value / 10);
1213 *out =
static_cast<Char
>(
'0' +
value % 10);
1218template <
typename Char,
typename UInt>
1223 while (
value >= 100) {
1235 out[--n] =
static_cast<Char
>(
'0' +
value);
1240template <
typename Char,
typename UInt>
1242 int num_digits) -> Char* {
1244 return out + num_digits;
1247template <
typename Char,
typename UInt,
typename OutputIt,
1262template <
typename Char,
typename UInt>
1264 int size,
bool upper =
false) -> Char* {
1267 const char* digits = upper ?
"0123456789ABCDEF" :
"0123456789abcdef";
1268 unsigned digit =
static_cast<unsigned>(
value & ((1u << base_bits) - 1));
1269 *--out =
static_cast<Char
>(base_bits < 4 ? static_cast<char>(
'0' + digit)
1271 }
while ((
value >>= base_bits) != 0);
1276template <
typename Char,
typename UInt>
1278 int num_digits,
bool upper =
false) -> Char* {
1280 return out + num_digits;
1283template <
typename Char,
typename OutputIt,
typename UInt,
1286 int num_digits,
bool upper =
false)
1307 return {&buffer_[0],
size()};
1309 inline auto size() const ->
size_t {
return buffer_.size() - 1; }
1310 inline auto c_str() const -> const
wchar_t* {
return &buffer_[0]; }
1311 inline auto str() const ->
std::wstring {
return {&buffer_[0],
size()}; }
1317template <
typename WChar,
typename Buffer = memory_buffer>
class to_utf8 {
1325 static_assert(
sizeof(WChar) == 2 ||
sizeof(WChar) == 4,
1326 "expected utf16 or utf32");
1328 FMT_THROW(std::runtime_error(
sizeof(WChar) == 2 ?
"invalid utf16"
1329 :
"invalid utf32"));
1333 auto size() const ->
size_t {
return buffer_.size() - 1; }
1334 auto c_str() const -> const
char* {
return &buffer_[0]; }
1335 auto str() const ->
std::
string {
return std::string(&buffer_[0],
size()); }
1343 if (!
convert(buffer_, s, policy))
return false;
1344 buffer_.push_back(0);
1350 for (
auto p = s.begin();
p != s.end(); ++
p) {
1351 uint32_t c =
static_cast<uint32_t
>(*p);
1352 if (
sizeof(WChar) == 2 && c >= 0xd800 && c <= 0xdfff) {
1355 if (
p == s.end() || (c & 0xfc00) != 0xd800 || (*
p & 0xfc00) != 0xdc00) {
1361 c = (c << 10) + static_cast<uint32_t>(*
p) - 0x35fdc00;
1365 }
else if (c < 0x800) {
1366 buf.
push_back(
static_cast<char>(0xc0 | (c >> 6)));
1367 buf.
push_back(
static_cast<char>(0x80 | (c & 0x3f)));
1368 }
else if ((c >= 0x800 && c <= 0xd7ff) || (c >= 0xe000 && c <= 0xffff)) {
1369 buf.
push_back(
static_cast<char>(0xe0 | (c >> 12)));
1370 buf.
push_back(
static_cast<char>(0x80 | ((c & 0xfff) >> 6)));
1371 buf.
push_back(
static_cast<char>(0x80 | (c & 0x3f)));
1372 }
else if (c >= 0x10000 && c <= 0x10ffff) {
1373 buf.
push_back(
static_cast<char>(0xf0 | (c >> 18)));
1374 buf.
push_back(
static_cast<char>(0x80 | ((c & 0x3ffff) >> 12)));
1375 buf.
push_back(
static_cast<char>(0x80 | ((c & 0xfff) >> 6)));
1376 buf.
push_back(
static_cast<char>(0x80 | (c & 0x3f)));
1389 return {
static_cast<uint64_t
>(
p >> 64),
static_cast<uint64_t
>(
p)};
1390#elif defined(_MSC_VER) && defined(_M_X64)
1391 auto hi = uint64_t();
1392 auto lo = _umul128(x, y, &hi);
1397 uint64_t a = x >> 32;
1398 uint64_t b = x & mask;
1399 uint64_t c = y >> 32;
1400 uint64_t d = y & mask;
1402 uint64_t ac = a * c;
1403 uint64_t bc = b * c;
1404 uint64_t ad = a * d;
1405 uint64_t bd = b * d;
1407 uint64_t intermediate = (bd >> 32) + (ad & mask) + (bc & mask);
1409 return {ac + (intermediate >> 32) + (ad >> 32) + (bc >> 32),
1410 (intermediate << 32) + (bd & mask)};
1418 FMT_ASSERT(e <= 2620 && e >= -2620,
"too large exponent");
1419 static_assert((-1 >> 1) == -1,
"right shift is not arithmetic");
1420 return (e * 315653) >> 20;
1424 FMT_ASSERT(e <= 1233 && e >= -1233,
"too large exponent");
1425 return (e * 1741647) >> 19;
1432 return static_cast<uint64_t
>(
p >> 64);
1433#elif defined(_MSC_VER) && defined(_M_X64)
1434 return __umulh(x, y);
1479template <
typename T>
1481 std::numeric_limits<T>::digits == 113 ||
1488template <
typename T>
1505 return std::numeric_limits<Float>::digits != 64;
1513 : (std::numeric_limits<Float>::digits -
1517template <
typename Float>
1527 : std::numeric_limits<Float>::max_exponent - 1;
1531 auto prefix_size = 2;
1533 if (abs_exp < 100)
return prefix_size + 2;
1534 return prefix_size + (abs_exp >= 1000 ? 4 : 3);
1538template <
typename Char,
typename OutputIt>
1542 *out++ =
static_cast<Char
>(
'-');
1545 *out++ =
static_cast<Char
>(
'+');
1547 auto uexp =
static_cast<uint32_t
>(
exp);
1549 if (uexp < 10) *out++ =
'0';
1553 const char* top =
digits2(uexp / 100);
1554 if (uexp >= 1000u) *out++ =
static_cast<Char
>(top[0]);
1555 *out++ =
static_cast<Char
>(top[1]);
1558 const char* d =
digits2(uexp);
1559 *out++ =
static_cast<Char
>(d[0]);
1560 *out++ =
static_cast<Char
>(d[1]);
1573 constexpr basic_fp(uint64_t f_val,
int e_val) :
f(f_val),
e(e_val) {}
1579 template <
typename Float, FMT_ENABLE_IF(!is_
double_
double<Float>::value)>
1581 static_assert(std::numeric_limits<Float>::digits <= 113,
"unsupported FP");
1584 const auto num_float_significand_bits =
1586 const auto implicit_bit = carrier_uint(1) << num_float_significand_bits;
1587 const auto significand_mask = implicit_bit - 1;
1589 f =
static_cast<F
>(u & significand_mask);
1591 num_float_significand_bits);
1594 auto is_predecessor_closer =
f == 0 && biased_e > 1;
1598 f +=
static_cast<F
>(implicit_bit);
1601 return is_predecessor_closer;
1604 template <
typename Float, FMT_ENABLE_IF(is_
double_
double<Float>::value)>
1606 static_assert(std::numeric_limits<double>::is_iec559,
"unsupported FP");
1607 return assign(
static_cast<double>(n));
1614template <
int SHIFT = 0,
typename F>
1618 const auto shifted_implicit_bit = implicit_bit << SHIFT;
1619 while ((
value.f & shifted_implicit_bit) == 0) {
1634 auto product =
static_cast<__uint128_t
>(lhs) * rhs;
1635 auto f =
static_cast<uint64_t
>(product >> 64);
1636 return (
static_cast<uint64_t
>(product) & (1ULL << 63)) != 0 ? f + 1 : f;
1639 uint64_t mask = (1ULL << 32) - 1;
1640 uint64_t a = lhs >> 32, b = lhs & mask;
1641 uint64_t c = rhs >> 32, d = rhs & mask;
1642 uint64_t ac = a * c, bc = b * c, ad = a * d, bd = b * d;
1644 uint64_t mid = (bd >> 32) + (ad & mask) + (bc & mask) + (1U << 31);
1645 return ac + (ad >> 32) + (bc >> 32) + (mid >> 32);
1650 return {
multiply(x.f, y.f), x.e + y.e + 64};
1657template <
typename T>
1662template <
bool C,
typename T,
typename F, FMT_ENABLE_IF(C)>
1666template <
bool C,
typename T,
typename F, FMT_ENABLE_IF(!C)>
1671template <
typename Char,
typename OutputIt>
1674 auto fill_size = specs.fill_size();
1675 if (fill_size == 1)
return detail::fill_n(it, n, specs.fill_unit<Char>());
1676 if (
const Char* data = specs.fill<Char>()) {
1677 for (
size_t i = 0; i < n; ++i) it = copy<Char>(data, data + fill_size, it);
1685template <
typename Char,
align default_align =
align::left,
typename OutputIt,
1688 size_t size,
size_t width, F&& f) -> OutputIt {
1692 size_t padding = spec_width >
width ? spec_width -
width : 0;
1696 default_align ==
align::left ?
"\x1f\x1f\x00\x01" :
"\x00\x1f\x00\x01";
1697 size_t left_padding = padding >> shifts[
static_cast<int>(specs.align())];
1698 size_t right_padding = padding - left_padding;
1699 auto it =
reserve(out, size + padding * specs.fill_size());
1700 if (left_padding != 0) it =
fill<Char>(it, left_padding, specs);
1702 if (right_padding != 0) it =
fill<Char>(it, right_padding, specs);
1706template <
typename Char,
align default_align =
align::left,
typename OutputIt,
1709 size_t size, F&& f) -> OutputIt {
1713template <
typename Char, align default_align = align::left,
typename OutputIt>
1718 const char* data = bytes.data();
1719 return copy<Char>(data, data + bytes.size(), it);
1723template <
typename Char,
typename OutputIt,
typename UIntPtr>
1729 *it++ =
static_cast<Char
>(
'0');
1730 *it++ =
static_cast<Char
>(
'x');
1741 if (cp < 0x20 || cp == 0x7f || cp ==
'"' || cp ==
'\\')
return true;
1752template <
typename Char>
1755 for (; begin != end; ++begin) {
1757 if (
const_check(
sizeof(Char) == 1) && cp >= 0x80)
continue;
1760 return {begin,
nullptr, 0};
1770 result = {sv.
begin(), sv.
end(), cp};
1778template <
size_t w
idth,
typename Char,
typename OutputIt>
1780 *out++ =
static_cast<Char
>(
'\\');
1781 *out++ =
static_cast<Char
>(prefix);
1788template <
typename OutputIt,
typename Char>
1791 auto c =
static_cast<Char
>(escape.cp);
1792 switch (escape.cp) {
1794 *out++ =
static_cast<Char
>(
'\\');
1795 c =
static_cast<Char
>(
'n');
1798 *out++ =
static_cast<Char
>(
'\\');
1799 c =
static_cast<Char
>(
'r');
1802 *out++ =
static_cast<Char
>(
'\\');
1803 c =
static_cast<Char
>(
't');
1807 case '\\': *out++ =
static_cast<Char
>(
'\\');
break;
1810 if (escape.cp < 0x10000)
1812 if (escape.cp < 0x110000)
1815 escape.begin,
to_unsigned(escape.end - escape.begin))) {
1817 static_cast<uint32_t
>(escape_char) & 0xFF);
1825template <
typename Char,
typename OutputIt>
1828 *out++ =
static_cast<Char
>(
'"');
1829 auto begin = str.begin(), end = str.end();
1836 }
while (begin != end);
1837 *out++ =
static_cast<Char
>(
'"');
1841template <
typename Char,
typename OutputIt>
1843 Char v_array[1] = {v};
1844 *out++ =
static_cast<Char
>(
'\'');
1845 if ((
needs_escape(
static_cast<uint32_t
>(v)) && v !=
static_cast<Char
>(
'"')) ||
1846 v ==
static_cast<Char
>(
'\'')) {
1849 static_cast<uint32_t
>(v)});
1853 *out++ =
static_cast<Char
>(
'\'');
1857template <
typename Char,
typename OutputIt>
1870 std::string grouping_;
1871 std::basic_string<Char> thousands_sep_;
1874 std::string::const_iterator group;
1877 auto initial_state()
const -> next_state {
return {grouping_.begin(), 0}; }
1880 auto next(next_state&
state)
const ->
int {
1882 if (
state.group == grouping_.end())
return state.pos += grouping_.back();
1891 if (!localized)
return;
1893 grouping_ = sep.grouping;
1894 if (sep.thousands_sep) thousands_sep_.assign(1, sep.thousands_sep);
1897 : grouping_(
std::move(grouping)), thousands_sep_(
std::move(sep)) {}
1903 auto state = initial_state();
1909 template <
typename Out,
typename C>
1911 auto num_digits =
static_cast<int>(digits.size());
1913 separators.push_back(0);
1914 auto state = initial_state();
1915 while (
int i = next(
state)) {
1916 if (i >= num_digits)
break;
1917 separators.push_back(i);
1919 for (
int i = 0, sep_index =
static_cast<int>(separators.size() - 1);
1920 i < num_digits; ++i) {
1921 if (num_digits - i == separators[sep_index]) {
1923 thousands_sep_.data() + thousands_sep_.size(), out);
1926 *out++ =
static_cast<Char
>(digits[
to_unsigned(i)]);
1934 prefix += (1u + (
value > 0xff ? 1 : 0)) << 24;
1938template <
typename OutputIt,
typename UInt,
typename Char>
1942 static_assert(std::is_same<uint64_or_128_t<UInt>, UInt>
::value,
"");
1945 switch (specs.type()) {
1954 prefix_append(prefix,
unsigned(specs.upper() ?
'X' :
'x') << 8 |
'0');
1962 if (specs.alt() && specs.precision <= num_digits &&
value != 0)
1968 prefix_append(prefix,
unsigned(specs.upper() ?
'B' :
'b') << 8 |
'0');
1976 unsigned size = (prefix != 0 ? prefix >> 24 : 0) +
to_unsigned(num_digits) +
1977 to_unsigned(grouping.count_separators(num_digits));
1980 for (
unsigned p = prefix & 0xffffff;
p != 0;
p >>= 8)
1981 *it++ =
static_cast<Char
>(
p & 0xff);
1993template <
typename OutputIt>
2004template <
typename T>
2010 prefix = 0x01000000 |
'-';
2011 abs_value = 0 - abs_value;
2013 constexpr unsigned prefixes[4] = {0, 0, 0x1000000u |
'+', 0x1000000u |
' '};
2014 prefix = prefixes[
static_cast<int>(s)];
2016 return {abs_value, prefix};
2026 template <
typename T, FMT_ENABLE_IF(is_
integer<T>::value)>
2034 template <
typename T, FMT_ENABLE_IF(!is_
integer<T>::value)>
2049 auto width = to_unsigned(specs.width);
2051 padding = width - size;
2054 }
else if (specs.precision > num_digits) {
2055 size = (prefix >> 24) + to_unsigned(specs.precision);
2056 padding = to_unsigned(specs.precision - num_digits);
2061template <
typename Char,
typename OutputIt,
typename T>
2064 static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>
::value,
"");
2067 char buffer[buffer_size];
2069 const char* begin =
nullptr;
2070 const char* end =
buffer + buffer_size;
2072 auto abs_value =
arg.abs_value;
2073 auto prefix =
arg.prefix;
2074 switch (specs.type()) {
2083 prefix_append(prefix,
unsigned(specs.upper() ?
'X' :
'x') << 8 |
'0');
2089 auto num_digits = end - begin;
2090 if (specs.alt() && specs.precision <= num_digits && abs_value != 0)
2097 prefix_append(prefix,
unsigned(specs.upper() ?
'B' :
'b') << 8 |
'0');
2106 int num_digits =
static_cast<int>(end - begin);
2108 if ((specs.width | (specs.precision + 1)) == 0) {
2110 for (
unsigned p = prefix & 0xffffff;
p != 0;
p >>= 8)
2111 *it++ =
static_cast<Char
>(
p & 0xff);
2115 unsigned padding = sp.padding;
2118 for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8)
2119 *it++ = static_cast<Char>(p & 0xff);
2120 it = detail::fill_n(it, padding, static_cast<Char>(
'0'));
2121 return copy<Char>(begin, end, it);
2125template <
typename Char,
typename OutputIt,
typename T>
2133template <
typename Char,
typename T,
2135 !std::is_same<T, bool>::value &&
2136 !std::is_same<T, Char>::value)>
2140 if (specs.localized() &&
write_loc(out,
value, specs, loc))
return out;
2146template <
typename Char,
typename OutputIt,
typename T,
2148 !std::is_same<T, bool>::value &&
2149 !std::is_same<T, Char>::value &&
2154 if (specs.localized() &&
write_loc(out,
value, specs, loc))
return out;
2158template <
typename Char,
typename OutputIt>
2162 using unsigned_type =
2164 return check_char_specs(specs)
2165 ? write_char<Char>(out, value, specs)
2166 : write<Char>(out, static_cast<unsigned_type>(value), specs, loc);
2169template <
typename Char,
typename OutputIt,
2175 auto&& it =
reserve(out, s.size());
2179 size_t display_width_limit =
2181 size_t display_width =
2182 !is_debug || specs.
precision == 0 ? 0 : 1;
2183 size_t size = !is_debug || specs.
precision == 0 ? 0 : 1;
2191 size_t cp_width = buf.
count();
2192 if (display_width + cp_width <= display_width_limit) {
2193 display_width += cp_width;
2196 if (display_width < display_width_limit && sv.
end() == s.end()) {
2203 size += display_width_limit - display_width;
2204 display_width = display_width_limit;
2209 if (cp_width + display_width <= display_width_limit) {
2210 display_width += cp_width;
2213 if (is_debug && display_width < display_width_limit &&
2214 sv.
end() == s.end()) {
2224 struct bounded_output_iterator {
2229 FMT_CONSTEXPR auto operator++() -> bounded_output_iterator& {
2232 FMT_CONSTEXPR auto operator++(
int) -> bounded_output_iterator& {
2235 FMT_CONSTEXPR auto operator=(
char c) -> bounded_output_iterator& {
2237 *underlying_iterator++ = c;
2248 .underlying_iterator
2253template <
typename Char,
typename OutputIt,
2257 auto data = s.data();
2258 auto size = s.size();
2276template <
typename Char,
typename OutputIt>
2282template <
typename Char,
typename OutputIt>
2291template <
typename Char,
typename OutputIt,
typename T,
2293 !std::is_same<T, bool>::value &&
2294 !std::is_same<T, Char>::value)>
2299 if (negative) abs_value = ~abs_value + 1;
2301 auto size = (negative ? 1 : 0) +
static_cast<size_t>(num_digits);
2303 if (negative) *
ptr++ =
static_cast<Char
>(
'-');
2307 if (negative) *out++ =
static_cast<Char
>(
'-');
2311template <
typename Char>
2317 if (end -
p <= 0)
p = begin;
2327 if (c ==
'}')
return begin;
2338 }
else if (
p == begin) {
2347template <
typename Char,
typename OutputIt>
2351 isnan ? (specs.
upper() ?
"NAN" :
"nan") : (specs.
upper() ?
"INF" :
"inf");
2352 constexpr size_t str_size = 3;
2353 auto size = str_size + (s !=
sign::none ? 1 : 0);
2355 const bool is_zero_fill =
2357 if (is_zero_fill) specs.
set_fill(
' ');
2374 return f.significand_size;
2376template <
typename T>
2381template <
typename Char,
typename OutputIt>
2383 int significand_size) -> OutputIt {
2384 return copy<Char>(significand, significand + significand_size, out);
2386template <
typename Char,
typename OutputIt,
typename UInt>
2388 int significand_size) -> OutputIt {
2391template <
typename Char,
typename OutputIt,
typename T,
typename Grouping>
2393 int significand_size,
int exponent,
2394 const Grouping& grouping) -> OutputIt {
2395 if (!grouping.has_separator()) {
2405template <
typename Char,
typename UInt,
2410 out += significand_size + 1;
2412 int floating_size = significand_size - integral_size;
2413 for (
int i = floating_size / 2; i > 0; --i) {
2415 write2digits(out,
static_cast<size_t>(significand % 100));
2418 if (floating_size % 2 != 0) {
2419 *--out =
static_cast<Char
>(
'0' + significand % 10);
2427template <
typename OutputIt,
typename UInt,
typename Char,
2430 int significand_size,
int integral_size,
2439template <
typename OutputIt,
typename Char>
2441 int significand_size,
int integral_size,
2448 significand + significand_size, out);
2451template <
typename OutputIt,
typename Char,
typename T,
typename Grouping>
2453 int significand_size,
int integral_size,
2455 const Grouping& grouping) -> OutputIt {
2456 if (!grouping.has_separator()) {
2472 return std::numeric_limits<T>::digits10 != 0
2473 ?
min_of(16, std::numeric_limits<T>::digits10 + 1)
2491 template <
typename Out,
typename C>
2497template <
typename Char,
typename Grouping,
typename OutputIt,
2503 using iterator = reserve_iterator<OutputIt>;
2505 int exp = f.exponent + significand_size;
2506 long long size = significand_size + (s !=
sign::none ? 1 : 0);
2507 if (f.exponent >= 0) {
2511 abort_fuzzing_if(num_zeros > 5000);
2516 if (num_zeros > 0) size += num_zeros;
2518 auto grouping = Grouping(loc, specs.
localized());
2519 size += grouping.count_separators(
exp);
2520 return write_padded<Char, align::right>(
2521 out, specs,
static_cast<size_t>(size), [&](iterator it) {
2523 it = write_significand<Char>(it, f.significand, significand_size,
2524 f.exponent, grouping);
2525 if (!specs.
alt())
return it;
2527 return num_zeros > 0 ?
detail::fill_n(it, num_zeros, Char(
'0')) : it;
2532 int num_zeros = specs.
alt() ? specs.
precision - significand_size : 0;
2533 size += 1 +
max_of(num_zeros, 0);
2534 auto grouping = Grouping(loc, specs.
localized());
2535 size += grouping.count_separators(
exp);
2536 return write_padded<Char, align::right>(
2540 decimal_point, grouping);
2541 return num_zeros > 0 ?
detail::fill_n(it, num_zeros, Char(
'0')) : it;
2545 int num_zeros = -
exp;
2546 if (significand_size == 0 && specs.
precision >= 0 &&
2550 bool pointy = num_zeros != 0 || significand_size != 0 || specs.
alt();
2551 size += 1 + (pointy ? 1 : 0) + num_zeros;
2552 return write_padded<Char, align::right>(
2556 if (!pointy)
return it;
2559 return write_significand<Char>(it, f.significand, significand_size);
2563template <
typename Char,
typename Grouping,
typename OutputIt,
2570 int exp = f.exponent + significand_size - 1;
2580 long long size = significand_size + (s !=
sign::none ? 1 : 0);
2584 }
else if (significand_size == 1) {
2588 char exp_char = specs.
upper() ?
'E' :
'e';
2593 if (num_zeros > 0) it =
detail::fill_n(it, num_zeros, Char(
'0'));
2594 *it++ = Char(exp_char);
2598 return specs.
width > 0
2603template <
typename Char,
typename OutputIt,
typename DecimalFP>
2620template <
typename T,
typename Enable =
void>
2623template <
typename T>
2625 : std::true_type {};
2627template <
typename T,
2630 constexpr T inf = T(std::numeric_limits<double>::infinity());
2633 return std::isfinite(
value);
2635template <
typename T, FMT_ENABLE_IF(!has_isfinite<T>::value)>
2637 T inf = T(std::numeric_limits<double>::infinity());
2642template <
typename T, FMT_ENABLE_IF(is_
floating_po
int<T>::value)>
2645#ifdef __cpp_if_constexpr
2646 if constexpr (std::numeric_limits<double>::is_iec559) {
2652 return std::signbit(
static_cast<double>(
value));
2659 FMT_THROW(format_error(
"number is too big"));
2666 using bigit = uint32_t;
2667 using double_bigit = uint64_t;
2669 enum { bigits_capacity = 32 };
2676 return i >= exp_ && i <
num_bigits() ? bigits_[i - exp_] : 0;
2680 auto result = double_bigit(bigits_[
index]) - other - borrow;
2681 bigits_[
index] =
static_cast<bigit
>(result);
2682 borrow =
static_cast<bigit
>(result >> (bigit_bits * 2 - 1));
2686 int num_bigits =
static_cast<int>(bigits_.
size()) - 1;
2687 while (num_bigits > 0 && bigits_[num_bigits] == 0) --num_bigits;
2688 bigits_.
resize(to_unsigned(num_bigits + 1));
2693 FMT_ASSERT(other.exp_ >= exp_,
"unaligned bigints");
2696 int i = other.exp_ - exp_;
2697 for (
size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j)
2698 subtract_bigits(i, other.bigits_[j], borrow);
2699 if (borrow != 0) subtract_bigits(i, 0, borrow);
2701 remove_leading_zeros();
2706 const double_bigit wide_value = value;
2707 for (
size_t i = 0, n = bigits_.
size(); i < n; ++i) {
2708 double_bigit result = bigits_[i] * wide_value + carry;
2709 bigits_[i] =
static_cast<bigit
>(result);
2710 carry =
static_cast<bigit
>(result >> bigit_bits);
2712 if (carry != 0) bigits_.
push_back(carry);
2715 template <
typename UInt, FMT_ENABLE_IF(std::is_same<UInt, u
int64_t>::value ||
2716 std::is_same<UInt, u
int128_t>::value)>
2719 conditional_t<std::is_same<UInt, uint128_t>::value, uint64_t, uint32_t>;
2720 const int shift = num_bits<half_uint>() - bigit_bits;
2721 const UInt lower =
static_cast<half_uint
>(value);
2722 const UInt upper = value >> num_bits<half_uint>();
2724 for (
size_t i = 0, n = bigits_.
size(); i < n; ++i) {
2725 UInt result = lower * bigits_[i] +
static_cast<bigit
>(carry);
2726 carry = (upper * bigits_[i] << shift) + (result >> bigit_bits) +
2727 (carry >> bigit_bits);
2728 bigits_[i] =
static_cast<bigit
>(result);
2730 while (carry != 0) {
2731 bigits_.
push_back(
static_cast<bigit
>(carry));
2732 carry >>= bigit_bits;
2736 template <
typename UInt, FMT_ENABLE_IF(std::is_same<UInt, u
int64_t>::value ||
2737 std::is_same<UInt, u
int128_t>::value)>
2739 size_t num_bigits = 0;
2741 bigits_[num_bigits++] =
static_cast<bigit
>(n);
2744 bigits_.
resize(num_bigits);
2756 auto size = other.bigits_.
size();
2757 bigits_.resize(size);
2758 auto data = other.bigits_.
data();
2769 return static_cast<int>(bigits_.size()) + exp_;
2774 exp_ += shift / bigit_bits;
2775 shift %= bigit_bits;
2776 if (shift == 0)
return *
this;
2778 for (
size_t i = 0, n = bigits_.size(); i < n; ++i) {
2779 bigit c = bigits_[i] >> (bigit_bits - shift);
2780 bigits_[i] = (bigits_[i] << shift) + carry;
2783 if (carry != 0) bigits_.push_back(carry);
2794 int num_bigits1 = b1.num_bigits(), num_bigits2 = b2.num_bigits();
2795 if (num_bigits1 != num_bigits2)
return num_bigits1 > num_bigits2 ? 1 : -1;
2796 int i =
static_cast<int>(b1.bigits_.size()) - 1;
2797 int j =
static_cast<int>(b2.bigits_.size()) - 1;
2799 if (end < 0) end = 0;
2800 for (; i >= end; --i, --j) {
2801 bigit b1_bigit = b1.bigits_[i], b2_bigit = b2.bigits_[j];
2802 if (b1_bigit != b2_bigit)
return b1_bigit > b2_bigit ? 1 : -1;
2804 if (i != j)
return i > j ? 1 : -1;
2810 const bigint& rhs) ->
int {
2811 int max_lhs_bigits =
max_of(lhs1.num_bigits(), lhs2.num_bigits());
2812 int num_rhs_bigits = rhs.num_bigits();
2813 if (max_lhs_bigits + 1 < num_rhs_bigits)
return -1;
2814 if (max_lhs_bigits > num_rhs_bigits)
return 1;
2815 double_bigit borrow = 0;
2816 int min_exp =
min_of(
min_of(lhs1.exp_, lhs2.exp_), rhs.exp_);
2817 for (
int i = num_rhs_bigits - 1; i >= min_exp; --i) {
2818 double_bigit sum = double_bigit(lhs1.get_bigit(i)) + lhs2.get_bigit(i);
2819 bigit rhs_bigit = rhs.get_bigit(i);
2820 if (sum > rhs_bigit + borrow)
return 1;
2821 borrow = rhs_bigit + borrow - sum;
2822 if (borrow > 1)
return -1;
2823 borrow <<= bigit_bits;
2825 return borrow != 0 ? -1 : 0;
2831 if (
exp == 0)
return *
this = 1;
2838 while (bitmask != 0) {
2840 if ((
exp & bitmask) != 0) *
this *= 5;
2847 int num_bigits =
static_cast<int>(bigits_.size());
2852 for (
int bigit_index = 0; bigit_index <
num_bigits; ++bigit_index) {
2855 for (
int i = 0, j = bigit_index; j >= 0; ++i, --j) {
2857 sum += double_bigit(n[i]) * n[j];
2859 bigits_[bigit_index] =
static_cast<bigit
>(sum);
2863 for (
int bigit_index =
num_bigits; bigit_index < num_result_bigits;
2866 sum += double_bigit(n[i++]) * n[j--];
2867 bigits_[bigit_index] =
static_cast<bigit
>(sum);
2870 remove_leading_zeros();
2877 int exp_difference = exp_ - other.exp_;
2878 if (exp_difference <= 0)
return;
2879 int num_bigits =
static_cast<int>(bigits_.size());
2881 for (
int i =
num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j)
2882 bigits_[j] = bigits_[i];
2884 exp_ -= exp_difference;
2891 if (
compare(*
this, divisor) < 0)
return 0;
2892 FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0,
"");
2896 subtract_aligned(divisor);
2898 }
while (
compare(*
this, divisor) >= 0);
2914 unsigned flags,
int num_digits,
2926 int shift = is_predecessor_closer ? 2 : 1;
2928 numerator =
value.f;
2929 numerator <<=
value.e + shift;
2932 if (is_predecessor_closer) {
2934 upper_store <<=
value.e + 1;
2935 upper = &upper_store;
2938 denominator <<= shift;
2939 }
else if (exp10 < 0) {
2941 lower.assign(numerator);
2942 if (is_predecessor_closer) {
2943 upper_store.assign(numerator);
2945 upper = &upper_store;
2947 numerator *=
value.f;
2948 numerator <<= shift;
2950 denominator <<= shift -
value.e;
2952 numerator =
value.f;
2953 numerator <<= shift;
2955 denominator <<= shift -
value.e;
2957 if (is_predecessor_closer) {
2958 upper_store = 1ULL << 1;
2959 upper = &upper_store;
2962 int even =
static_cast<int>((
value.f & 1) == 0);
2963 if (!upper) upper = &lower;
2964 bool shortest = num_digits < 0;
2966 if (add_compare(numerator, *upper, denominator) + even <= 0) {
2969 if (num_digits < 0) {
2971 if (upper != &lower) *upper *= 10;
2980 char* data = buf.
data();
2983 bool low =
compare(numerator, lower) - even < 0;
2985 bool high = add_compare(numerator, *upper, denominator) + even > 0;
2986 data[num_digits++] =
static_cast<char>(
'0' + digit);
2989 ++data[num_digits - 1];
2991 int result = add_compare(numerator, numerator, denominator);
2993 if (result > 0 || (result == 0 && (digit % 2) != 0))
2994 ++data[num_digits - 1];
2997 exp10 -= num_digits - 1;
3002 if (upper != &lower) *upper *= 10;
3006 exp10 -= num_digits - 1;
3007 if (num_digits <= 0) {
3009 if (num_digits == 0) {
3011 digit = add_compare(numerator, numerator, denominator) > 0 ?
'1' :
'0';
3017 for (
int i = 0; i < num_digits - 1; ++i) {
3019 buf[i] =
static_cast<char>(
'0' + digit);
3023 auto result = add_compare(numerator, numerator, denominator);
3024 if (result > 0 || (result == 0 && (digit % 2) != 0)) {
3026 const auto overflow =
'0' + 10;
3027 buf[num_digits - 1] = overflow;
3029 for (
int i = num_digits - 1; i > 0 && buf[i] == overflow; --i) {
3033 if (buf[0] == overflow) {
3044 buf[num_digits - 1] =
static_cast<char>(
'0' + digit);
3048template <
typename Float, FMT_ENABLE_IF(!is_
double_
double<Float>::value)>
3053 static_assert(!std::is_same<Float, float>::value,
"");
3058 using carrier_uint =
typename info::carrier_uint;
3063 f.
e += num_float_significand_bits;
3066 const auto num_fraction_bits =
3068 const auto num_xdigits = (num_fraction_bits + 3) / 4;
3070 const auto leading_shift = ((num_xdigits - 1) * 4);
3071 const auto leading_mask = carrier_uint(0xF) << leading_shift;
3072 const auto leading_xdigit =
3073 static_cast<uint32_t
>((f.
f & leading_mask) >> leading_shift);
3074 if (leading_xdigit > 1) f.
e -= (32 -
countl_zero(leading_xdigit) - 1);
3076 int print_xdigits = num_xdigits - 1;
3078 const int shift = ((print_xdigits - specs.
precision - 1) * 4);
3079 const auto mask = carrier_uint(0xF) << shift;
3080 const auto v =
static_cast<uint32_t
>((f.
f & mask) >> shift);
3083 const auto inc = carrier_uint(1) << (shift + 4);
3090 const auto implicit_bit = carrier_uint(1) << num_float_significand_bits;
3091 if ((f.
f & implicit_bit) == implicit_bit) {
3105 while (print_xdigits > 0 && xdigits[print_xdigits] ==
'0') --print_xdigits;
3110 if (specs.
alt() || print_xdigits > 0 || print_xdigits < specs.
precision)
3112 buf.
append(xdigits + 1, xdigits + 1 + print_xdigits);
3120 abs_e =
static_cast<uint32_t
>(-f.
e);
3123 abs_e =
static_cast<uint32_t
>(f.
e);
3128template <
typename Float, FMT_ENABLE_IF(is_
double_
double<Float>::value)>
3141 return U
"\x9999999a\x828f5c29\x80418938\x80068db9\x8000a7c6\x800010c7"
3142 U
"\x800001ae\x8000002b"[
index];
3145template <
typename Float>
3150 static_assert(!std::is_same<Float, float>::value,
"");
3165 bool use_dragon =
true;
3166 unsigned dragon_flags = 0;
3168 const auto inv_log2_10 = 0.3010299956639812;
3176 exp =
static_cast<int>(e);
3184 const uint64_t significand_mask =
3186 uint64_t significand = (br & significand_mask);
3190 if (exponent != 0) {
3197 FMT_ASSERT(significand != 0,
"zeros should not appear here");
3202 exponent = (std::numeric_limits<double>::min_exponent -
3205 significand <<= shift;
3213 uint64_t first_segment;
3214 bool has_more_segments;
3215 int digits_in_the_first_segment;
3219 first_segment = r.high();
3220 has_more_segments = r.low() != 0;
3223 if (first_segment >= 1000000000000000000ULL) {
3224 digits_in_the_first_segment = 19;
3228 digits_in_the_first_segment = 18;
3229 first_segment *= 10;
3238 if (digits_in_the_first_segment >
precision) {
3242 exp += digits_in_the_first_segment;
3250 if ((first_segment |
static_cast<uint64_t
>(has_more_segments)) >
3251 5000000000000000000ULL) {
3268 const uint32_t first_subsegment =
static_cast<uint32_t
>(
3271 const uint64_t second_third_subsegments =
3272 first_segment - first_subsegment * 10000000000ULL;
3276 bool should_round_up;
3280 auto print_subsegment = [&](uint32_t subsegment,
char*
buffer) {
3281 int number_of_digits_printed = 0;
3284 if ((number_of_digits_to_print & 1) != 0) {
3290 prod = ((subsegment *
static_cast<uint64_t
>(720575941)) >> 24) + 1;
3291 digits =
static_cast<uint32_t
>(prod >> 32);
3292 *
buffer =
static_cast<char>(
'0' + digits);
3293 number_of_digits_printed++;
3303 prod = ((subsegment *
static_cast<uint64_t
>(450359963)) >> 20) + 1;
3304 digits =
static_cast<uint32_t
>(prod >> 32);
3306 number_of_digits_printed += 2;
3310 while (number_of_digits_printed < number_of_digits_to_print) {
3311 prod =
static_cast<uint32_t
>(prod) *
static_cast<uint64_t
>(100);
3312 digits =
static_cast<uint32_t
>(prod >> 32);
3314 number_of_digits_printed += 2;
3319 print_subsegment(first_subsegment, buf.
data());
3338 uint32_t fractional_part =
static_cast<uint32_t
>(prod);
3341 8 - number_of_digits_to_print) ||
3342 ((fractional_part >> 31) &
3343 ((digits & 1) | (second_third_subsegments != 0) |
3344 has_more_segments)) != 0;
3352 should_round_up = second_third_subsegments > 5000000000ULL ||
3353 (second_third_subsegments == 5000000000ULL &&
3354 ((digits & 1) != 0 || has_more_segments));
3363 const uint32_t second_subsegment =
3365 second_third_subsegments, 1844674407370955162ULL));
3366 const uint32_t third_subsegment =
3367 static_cast<uint32_t
>(second_third_subsegments) -
3368 second_subsegment * 10;
3370 number_of_digits_to_print =
precision - 9;
3371 print_subsegment(second_subsegment, buf.
data() + 9);
3378 uint32_t fractional_part =
static_cast<uint32_t
>(prod);
3381 8 - number_of_digits_to_print) ||
3382 ((fractional_part >> 31) &
3383 ((digits & 1) | (third_subsegment != 0) |
3384 has_more_segments)) != 0;
3391 should_round_up = third_subsegment > 5 ||
3392 (third_subsegment == 5 &&
3393 ((digits & 1) != 0 || has_more_segments));
3398 if (should_round_up) {
3400 for (
int i =
precision - 1; i > 0 && buf[i] >
'9'; --i) {
3417 exp += digits_in_the_first_segment - 1;
3422 bool is_predecessor_closer = binary32 ? f.assign(
static_cast<float>(
value))
3423 : f.assign(converted_value);
3428 const int max_double_digits = 767;
3434 auto num_digits = buf.
size();
3435 while (num_digits > 0 && buf[num_digits - 1] ==
'0') {
3444template <
typename Char,
typename OutputIt,
typename T,
3448 if (specs.
localized() && write_loc(out, value, specs, loc))
return out;
3454 return write_nonfinite<Char>(out,
detail::isnan(value), specs, s);
3464 if (precision < 0) {
3469 auto dec = dragonbox::to_decimal(
static_cast<fast_float_t<T>
>(value));
3470 return write_float<Char>(out,
dec, specs, s, exp_upper, loc);
3478 return write_bytes<Char, align::right>(out, {buffer.
data(), buffer.
size()},
3483 if (precision == max_value<int>())
3490 }
else if (precision == 0) {
3494 std::is_same<T, float>(), buffer);
3497 auto f = big_decimal_fp{buffer.
data(),
static_cast<int>(buffer.
size()),
exp};
3498 return write_float<Char>(out, f, specs, s, exp_upper, loc);
3501template <
typename Char,
typename OutputIt,
typename T,
3512 auto significand =
dec.significand;
3514 int exponent =
dec.exponent + significand_size - 1;
3517 out,
dec, significand_size, Char(
'.'), {}, s);
3521 const char* prefix =
"e+";
3522 int abs_exponent = exponent;
3524 abs_exponent = -exponent;
3527 auto has_decimal_point = significand_size != 1;
3528 size_t size = std::is_pointer<OutputIt>::value
3531 (has_decimal_point ? 1 : 0) +
3532 (abs_exponent >= 100 ? 5 : 4));
3535 if (has_decimal_point) {
3541 *
ptr++ =
static_cast<Char
>(
'0' + significand);
3543 if (std::is_same<Char, char>::value) {
3544 memcpy(
ptr, prefix, 2);
3550 if (abs_exponent >= 100) {
3551 *
ptr++ =
static_cast<Char
>(
'0' + abs_exponent / 100);
3552 abs_exponent %= 100;
3561 has_decimal_point ? Char(
'.') : Char());
3567template <
typename Char,
typename OutputIt,
typename T,
3569 !is_fast_float<T>::value)>
3574template <
typename Char,
typename OutputIt>
3581template <
typename Char,
typename OutputIt>
3587template <
typename Char,
typename OutputIt,
typename T,
3595 typename Char,
typename OutputIt,
typename T,
3596 bool check = std::is_enum<T>::value && !std::is_same<T, Char>::value &&
3597 mapped_type_constant<T, Char>::value != type::custom_type,
3603template <
typename Char,
typename OutputIt,
typename T,
3609 ? write<Char>(out, value ? 1 : 0, specs, {})
3610 :
write_bytes<Char>(out, value ?
"true" :
"false", specs);
3613template <
typename Char,
typename OutputIt>
3620template <
typename Char,
typename OutputIt>
3627template <
typename Char,
typename OutputIt,
typename T,
3631 return write_ptr<Char>(out, bit_cast<uintptr_t>(value), &specs);
3634template <
typename Char,
typename OutputIt,
typename T,
3636 type::custom_type &&
3637 !std::is_fundamental<T>::value)>
3643 return f.format(
value, ctx);
3646template <
typename T>
3659 template <
typename T, FMT_ENABLE_IF(is_builtin<T>::value)>
3664 template <
typename T, FMT_ENABLE_IF(!is_builtin<T>::value)>
3673 h.
format(parse_ctx, format_ctx);
3682 template <
typename T, FMT_ENABLE_IF(is_builtin<T>::value)>
3687 template <
typename T, FMT_ENABLE_IF(!is_builtin<T>::value)>
3699 template <
typename T, FMT_ENABLE_IF(is_
integer<T>::value)>
3704 template <
typename T, FMT_ENABLE_IF(!is_
integer<T>::value)>
3711template <
typename Context>
3722 value =
static_cast<int>(result);
3725#if FMT_USE_NONTYPE_TEMPLATE_ARGS
3726template <
typename T,
typename Char,
size_t N,
3727 fmt::detail::fixed_string<Char, N> Str>
3728struct static_named_arg : view {
3729 static constexpr auto name = Str.data;
3732 static_named_arg(
const T& v) : value(v) {}
3735template <
typename T,
typename Char,
size_t N,
3736 fmt::detail::fixed_string<Char, N> Str>
3737struct is_named_arg<static_named_arg<T, Char, N, Str>> : std::true_type {};
3739template <
typename T,
typename Char,
size_t N,
3740 fmt::detail::fixed_string<Char, N> Str>
3741struct is_static_named_arg<static_named_arg<T, Char, N, Str>> : std::true_type {
3744template <
typename Char,
size_t N, fmt::detail::fixed_
string<Char, N> Str>
3746 template <
typename T>
auto operator=(T&& value)
const {
3747 return static_named_arg<T, Char, N, Str>(std::forward<T>(value));
3755 return {
str, std::forward<T>(
value)};
3764 void on_text(
const Char* begin,
const Char* end) {
3775 int arg_id =
ctx.arg_id(
id);
3797 specs.precision_ref,
ctx);
3810 const char* message)
noexcept;
3815template <
typename T,
typename Char, type TYPE>
3816template <
typename FormatContext>
3818 const T& val, FormatContext& ctx)
const ->
decltype(ctx.out()) {
3819 if (!specs_.dynamic())
3820 return write<Char>(ctx.out(), val, specs_, ctx.locale());
3825 specs_.precision_ref, ctx);
3826 return write<Char>(ctx.out(), val, specs, ctx.locale());
3849 : out_(
out), args_(args), loc_(loc) {}
3855 return args_.get(
id);
3859 return args_.get(
name);
3862 return args_.get_id(
name);
3879 template <
typename T, FMT_ENABLE_IF(!detail::is_
float128<T>::value)>
3882 template <
typename T, FMT_ENABLE_IF(detail::is_
float128<T>::value)>
3885 template <
typename Visitor>
auto visit(Visitor&& vis) ->
decltype(vis(0)) {
3886 return value_.visit(vis);
3894 std::string separator_;
3895 std::string grouping_;
3896 std::string decimal_point_;
3907 std::string decimal_point =
".")
3908 : separator_(sep.data(), sep.size()),
3909 grouping_(grouping),
3910 decimal_point_(decimal_point) {}
3914 return do_put(out, val, specs);
3918#define FMT_FORMAT_AS(Type, Base) \
3919 template <typename Char> \
3920 struct formatter<Type, Char> : formatter<Base, Char> { \
3921 template <typename FormatContext> \
3922 FMT_CONSTEXPR auto format(Type value, FormatContext& ctx) const \
3923 -> decltype(ctx.out()) { \
3924 return formatter<Base, Char>::format(value, ctx); \
3939template <
typename Char,
size_t N>
3942template <
typename Char,
typename Traits,
typename Allocator>
3944 :
public formatter<basic_string_view<Char>, Char> {};
3946template <
int N,
typename Char>
3948template <
int N,
typename Char>
3950 :
formatter<unsigned long long, Char> {};
3952template <
typename Char>
3955 detail::type::float_type> {};
3957template <
typename T,
typename Char>
3959 :
formatter<detail::format_as_result<T>, Char> {
3960 template <
typename FormatContext>
3962 ->
decltype(ctx.out()) {
3975template <
typename T>
auto ptr(T
p) ->
const void* {
3976 static_assert(std::is_pointer<T>::value,
"fmt::ptr used with non-pointer");
3988template <
typename Enum>
3994template <
typename Enum, FMT_ENABLE_IF(std::is_enum<Enum>::value)>
4000#ifdef __cpp_lib_byte
4001template <
typename Char>
4003 static auto format_as(std::byte b) ->
unsigned char {
4004 return static_cast<unsigned char>(b);
4006 template <
typename Context>
4007 auto format(std::byte b, Context& ctx)
const ->
decltype(ctx.out()) {
4025 return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx,
4029 template <
typename FormatContext>
4030 auto format(
bytes b, FormatContext& ctx)
const ->
decltype(ctx.out()) {
4031 auto specs = specs_;
4033 specs.width_ref, ctx);
4035 specs.precision_ref, ctx);
4064 return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx,
4068 template <
typename FormatContext>
4070 ->
decltype(ctx.out()) {
4071 auto specs = specs_;
4073 specs.width_ref, ctx);
4075 specs.precision_ref, ctx);
4088template <
typename T,
typename Char>
4093 template <
typename FormatContext>
4095 ->
decltype(ctx.out()) {
4096 return view.fmt->format(*view.value, ctx);
4110 auto it = ctx.begin(), end = ctx.end();
4111 if (it == end)
return it;
4117 if ((c >=
'0' && c <=
'9') || c ==
'{') {
4119 width_ = specs.
width;
4122 return formatter_.parse(ctx);
4125 template <
typename FormatContext,
typename F>
4126 auto write_padded(FormatContext& ctx, F write)
const ->
decltype(ctx.out()) {
4127 if (width_ == 0)
return write(ctx.out());
4131 specs.
width = width_;
4144#if FMT_USE_NONTYPE_TEMPLATE_ARGS
4145template <detail::fixed_
string S>
constexpr auto operator""_a() {
4169 enum { buffer_size = std::numeric_limits<unsigned long long>::digits10 + 3 };
4170 mutable char buffer_[buffer_size];
4173 template <
typename UInt>
4179 template <
typename Int>
4182 bool negative = value < 0;
4183 if (negative) abs_value = 0 - abs_value;
4184 auto begin = format_unsigned(abs_value);
4185 if (negative) *--begin =
'-';
4192 : str_(format_signed(value)) {}
4194 : str_(format_signed(value)) {}
4196 : str_(format_unsigned(value)) {}
4198 : str_(format_unsigned(value)) {}
4200 : str_(format_unsigned(value)) {}
4214 buffer_[buffer_size - 1] =
'\0';
4219 inline auto str() const ->
std::
string {
return {str_,
size()}; }
4222#if FMT_CLANG_ANALYZER
4223# define FMT_STRING_IMPL(s, base) s
4225# define FMT_STRING_IMPL(s, base) \
4229 struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \
4230 using char_type = fmt::remove_cvref_t<decltype(s[0])>; \
4231 constexpr explicit operator fmt::basic_string_view<char_type>() \
4233 return fmt::detail::compile_string_to_view<char_type>(s); \
4236 using FMT_STRING_VIEW = \
4237 fmt::basic_string_view<typename FMT_COMPILE_STRING::char_type>; \
4238 fmt::detail::ignore_unused(FMT_STRING_VIEW(FMT_COMPILE_STRING())); \
4239 return FMT_COMPILE_STRING(); \
4251#define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string)
4254 -> std::system_error;
4271template <
typename... T>
4273 -> std::system_error {
4291 const char* message)
noexcept;
4304template <
typename... T>
4310template <
typename OutputIt,
4319template <
typename OutputIt,
typename... T,
4322 T&&... args) -> OutputIt {
4323 return fmt::vformat_to(out, loc, fmt.str,
vargs<T...>{{args...}});
4326template <
typename... T>
4329 T&&... args) ->
size_t {
4346template <
typename... T>
4359template <
typename T, FMT_ENABLE_IF(std::is_
integral<T>::value)>
4367template <
typename T, FMT_ENABLE_IF(detail::use_format_as<T>::value)>
4373template <
typename T, FMT_ENABLE_IF(!std::is_
integral<T>::value &&
4374 !detail::use_format_as<T>::value)>
4379 return {buffer.
data(), buffer.
size()};
4385#ifdef FMT_HEADER_ONLY
4386# define FMT_FUNC inline
4391#ifdef FMT_REMOVE_TRANSITIVE_INCLUDES
4392# undef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
constexpr auto format_as(HAL_AddressableLEDColorOrder order)
Definition AddressableLEDTypes.h:34
#define S(label, offset, message)
Definition Errors.hpp:113
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 glfw and nanopb were 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:140
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 glfw and nanopb were 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 or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf the Licensor for the purpose of discussing and improving the but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work Grant of Copyright License Subject to the terms and conditions of this each Contributor hereby grants to You a non no royalty free
Definition ThirdPartyNotices.txt:163
typename std::enable_if< B, T >::type enable_if_t
Definition base.h:307
#define FMT_ASSERT(condition, message)
Definition base.h:394
#define FMT_END_EXPORT
Definition base.h:267
std::integral_constant< bool, B > bool_constant
Definition base.h:310
#define FMT_BUILTIN_TYPES
Definition base.h:296
#define FMT_PRAGMA_CLANG(x)
Definition base.h:224
#define FMT_CONSTEVAL
Definition base.h:142
basic_string_view< char > string_view
Definition base.h:620
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:2846
constexpr auto min_of(T a, T b) -> T
Definition base.h:347
detail::format_arg_store< context, sizeof...(T), detail::count_named_args< T... >(), detail::make_descriptor< context, T... >()> vargs
Definition base.h:2832
#define FMT_FALLTHROUGH
Definition base.h:188
#define FMT_NODISCARD
Definition base.h:203
typename std::remove_reference< T >::type remove_reference_t
Definition base.h:312
typename fstring< T... >::t format_string
Definition base.h:2794
#define FMT_GCC_VERSION
Definition base.h:35
#define FMT_OPTIMIZE_SIZE
Definition base.h:290
basic_appender< char > appender
Definition base.h:623
typename std::remove_cv< remove_reference_t< T > >::type remove_cvref_t
Definition base.h:316
constexpr auto max_of(T a, T b) -> T
Definition base.h:350
#define FMT_CONSTEXPR
Definition base.h:113
align
Definition base.h:688
@ none
Definition base.h:688
@ numeric
Definition base.h:688
@ right
Definition base.h:688
@ left
Definition base.h:688
@ center
Definition base.h:688
arg_id_kind
Definition base.h:690
@ none
Definition base.h:690
@ index
Definition base.h:690
@ name
Definition base.h:690
#define FMT_BEGIN_NAMESPACE
Definition base.h:256
sign
Definition base.h:689
@ none
Definition base.h:689
@ minus
Definition base.h:689
conditional_t< std::is_same< OutputIt, appender >::value, context, generic_context< OutputIt, Char > > basic_format_context
Definition base.h:636
#define FMT_API
Definition base.h:286
#define FMT_ENABLE_IF(...)
Definition base.h:344
#define FMT_BEGIN_EXPORT
Definition base.h:266
void void_t
Definition base.h:331
#define FMT_INLINE
Definition base.h:250
#define FMT_NO_UNIQUE_ADDRESS
Definition base.h:177
basic_format_args< context > format_args
Definition base.h:651
#define FMT_NORETURN
Definition base.h:195
#define FMT_MSC_WARNING(...)
Definition base.h:229
typename std::conditional< B, T, F >::type conditional_t
Definition base.h:309
#define FMT_CONSTEXPR20
Definition base.h:143
typename std::underlying_type< T >::type underlying_t
Definition base.h:320
@ oct
Definition base.h:674
@ hexfloat
Definition base.h:685
@ dec
Definition base.h:672
@ none
Definition base.h:667
@ chr
Definition base.h:676
@ debug
Definition base.h:668
@ exp
Definition base.h:682
@ string
Definition base.h:669
@ hex
Definition base.h:673
@ bin
Definition base.h:675
@ pointer
Definition base.h:679
@ fixed
Definition base.h:683
#define FMT_END_NAMESPACE
Definition base.h:259
conditional_t< std::is_same< Char, char >::value, context, generic_context< basic_appender< Char >, Char > > buffered_context
Definition base.h:642
#define FMT_EXPORT
Definition base.h:265
A dynamically growing memory buffer for trivially copyable/constructible types with the first SIZE el...
Definition format.h:797
const T & const_reference
Definition format.h:836
FMT_CONSTEXPR20 ~basic_memory_buffer()
Definition format.h:844
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:895
void reserve(size_t new_capacity)
Increases the buffer capacity to new_capacity.
Definition format.h:910
auto get_allocator() const -> Allocator
Definition format.h:903
FMT_CONSTEXPR20 void append(const ContiguousRange &range)
Definition format.h:914
FMT_CONSTEXPR basic_memory_buffer(const Allocator &alloc=Allocator())
Definition format.h:838
FMT_CONSTEXPR void resize(size_t count)
Resizes the buffer to contain count elements.
Definition format.h:907
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:889
T value_type
Definition format.h:835
FMT_CONSTEXPR void copy_fill_from(const basic_specs &specs)
Definition base.h:838
FMT_CONSTEXPR void set_fill(char c)
Definition base.h:817
constexpr auto align() const -> align
Definition base.h:751
FMT_CONSTEXPR auto dynamic_precision() const -> arg_id_kind
Definition base.h:765
constexpr auto sign() const -> sign
Definition base.h:778
FMT_CONSTEXPR void set_alt()
Definition base.h:789
constexpr auto localized() const -> bool
Definition base.h:792
constexpr auto dynamic() const -> bool
Definition base.h:774
constexpr auto upper() const -> bool
Definition base.h:785
constexpr auto type() const -> presentation_type
Definition base.h:744
constexpr auto alt() const -> bool
Definition base.h:788
constexpr auto dynamic_width() const -> arg_id_kind
Definition base.h:758
constexpr auto fill_unit() const -> Char
Definition base.h:810
FMT_CONSTEXPR void set_align(fmt::align a)
Definition base.h:754
constexpr auto fill_size() const -> size_t
Definition base.h:797
An implementation of std::basic_string_view for pre-C++17.
Definition base.h:522
constexpr auto end() const noexcept -> iterator
Definition base.h:570
constexpr auto size() const noexcept -> size_t
Returns the string size.
Definition base.h:567
constexpr auto data() const noexcept -> const Char *
Returns a pointer to the string data.
Definition base.h:564
constexpr auto begin() const noexcept -> iterator
Definition base.h:569
FMT_CONSTEXPR void align(const bigint &other)
Definition format.h:2876
FMT_CONSTEXPR auto operator<<=(int shift) -> bigint &
Definition format.h:2772
FMT_CONSTEXPR20 void square()
Definition format.h:2846
FMT_CONSTEXPR bigint()
Definition format.h:2749
FMT_CONSTEXPR auto operator*=(Int value) -> bigint &
Definition format.h:2787
FMT_CONSTEXPR void operator=(Int n)
Definition format.h:2763
FMT_CONSTEXPR void assign(const bigint &other)
Definition format.h:2755
void operator=(const bigint &)=delete
bigint(uint64_t n)
Definition format.h:2750
FMT_CONSTEXPR20 void assign_pow10(int exp)
Definition format.h:2829
friend FMT_CONSTEXPR auto compare(const bigint &b1, const bigint &b2) -> int
Definition format.h:2793
FMT_CONSTEXPR auto num_bigits() const -> int
Definition format.h:2768
friend FMT_CONSTEXPR auto add_compare(const bigint &lhs1, const bigint &lhs2, const bigint &rhs) -> int
Definition format.h:2809
FMT_CONSTEXPR auto divmod_assign(const bigint &divisor) -> int
Definition format.h:2889
bigint(const bigint &)=delete
A contiguous memory buffer with an optional growing ability.
Definition base.h:1773
FMT_CONSTEXPR buffer(grow_fun grow, size_t sz) noexcept
Definition base.h:1785
FMT_CONSTEXPR20 void append(const U *begin, const U *end)
Appends data to the end of the buffer.
Definition base.h:1855
FMT_CONSTEXPR void push_back(const T &value)
Definition base.h:1842
FMT_CONSTEXPR void set(T *buf_data, size_t buf_capacity) noexcept
Sets the buffer data and capacity.
Definition base.h:1796
constexpr auto size() const noexcept -> size_t
Returns the size of this buffer.
Definition base.h:1815
FMT_CONSTEXPR void try_reserve(size_t new_capacity)
Definition base.h:1838
auto end() noexcept -> T *
Definition base.h:1809
FMT_CONSTEXPR void try_resize(size_t count)
Definition base.h:1829
constexpr auto capacity() const noexcept -> size_t
Returns the capacity of this buffer.
Definition base.h:1818
FMT_CONSTEXPR auto data() noexcept -> T *
Returns a pointer to the buffer data (not null-terminated).
Definition base.h:1821
FMT_CONSTEXPR void clear()
Clears this buffer.
Definition base.h:1825
constexpr auto count() const noexcept -> size_t
Definition base.h:2050
auto apply(Out out, basic_string_view< C > digits) const -> Out
Definition format.h:1910
digit_grouping(locale_ref loc, bool localized=true)
Definition format.h:1890
digit_grouping(std::string grouping, std::basic_string< Char > sep)
Definition format.h:1896
auto has_separator() const -> bool
Definition format.h:1899
auto count_separators(int num_digits) const -> int
Definition format.h:1901
constexpr auto has_separator() const -> bool
Definition format.h:2487
constexpr auto count_separators(int) const -> int
Definition format.h:2489
constexpr fallback_digit_grouping(locale_ref, bool)
Definition format.h:2485
constexpr auto apply(Out out, basic_string_view< C >) const -> Out
Definition format.h:2492
static auto convert(Buffer &buf, basic_string_view< WChar > s, to_utf8_error_policy policy=to_utf8_error_policy::abort) -> bool
Definition format.h:1347
auto convert(basic_string_view< WChar > s, to_utf8_error_policy policy=to_utf8_error_policy::abort) -> bool
Definition format.h:1340
to_utf8(basic_string_view< WChar > s, to_utf8_error_policy policy=to_utf8_error_policy::abort)
Definition format.h:1323
to_utf8()
Definition format.h:1322
auto c_str() const -> const char *
Definition format.h:1334
auto size() const -> size_t
Definition format.h:1333
auto str() const -> std::string
Definition format.h:1335
FMT_CONSTEXPR auto operator>>=(int shift) -> uint128_fallback &
Definition format.h:376
constexpr uint128_fallback(uint64_t hi, uint64_t lo)
Definition format.h:310
FMT_CONSTEXPR auto operator>>(int shift) const -> uint128_fallback
Definition format.h:366
friend constexpr auto operator==(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition format.h:321
friend FMT_CONSTEXPR auto operator*(const uint128_fallback &lhs, uint32_t rhs) -> uint128_fallback
Definition format.h:354
friend constexpr auto operator|(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition format.h:333
friend constexpr auto operator-(const uint128_fallback &lhs, uint64_t rhs) -> uint128_fallback
Definition format.h:362
FMT_CONSTEXPR auto operator<<(int shift) const -> uint128_fallback
Definition format.h:371
friend constexpr auto operator!=(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition format.h:325
friend constexpr auto operator~(const uint128_fallback &n) -> uint128_fallback
Definition format.h:343
friend FMT_CONSTEXPR auto operator+(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition format.h:347
friend constexpr auto operator>(const uint128_fallback &lhs, const uint128_fallback &rhs) -> bool
Definition format.h:329
constexpr uint128_fallback(uint64_t value=0)
Definition format.h:311
constexpr auto high() const noexcept -> uint64_t
Definition format.h:313
FMT_CONSTEXPR void operator+=(uint128_fallback n)
Definition format.h:379
friend constexpr auto operator&(const uint128_fallback &lhs, const uint128_fallback &rhs) -> uint128_fallback
Definition format.h:338
FMT_CONSTEXPR20 auto operator+=(uint64_t n) noexcept -> uint128_fallback &
Definition format.h:391
FMT_CONSTEXPR void operator&=(uint128_fallback n)
Definition format.h:386
constexpr auto low() const noexcept -> uint64_t
Definition format.h:314
FMT_API utf8_to_utf16(string_view s)
Definition format-inl.h:1410
auto size() const -> size_t
Definition format.h:1309
auto c_str() const -> const wchar_t *
Definition format.h:1310
auto str() const -> std::wstring
Definition format.h:1311
generic_context(const generic_context &)=delete
void operator=(const generic_context &)=delete
constexpr generic_context(OutputIt out, basic_format_args< generic_context > args, locale_ref loc={})
Definition format.h:3846
@ builtin_types
Definition format.h:3844
constexpr auto out() const -> iterator
Definition format.h:3865
generic_context(generic_context &&)=default
void advance_to(iterator it)
Definition format.h:3867
auto arg(basic_string_view< Char > name) const -> basic_format_arg< generic_context >
Definition format.h:3857
OutputIt iterator
Definition format.h:3843
constexpr auto arg_id(basic_string_view< Char > name) const -> int
Definition format.h:3861
constexpr auto arg(int id) const -> basic_format_arg< generic_context >
Definition format.h:3854
Char char_type
Definition format.h:3842
constexpr auto locale() const -> locale_ref
Definition format.h:3871
loc_value(T)
Definition format.h:3883
loc_value(T value)
Definition format.h:3880
auto visit(Visitor &&vis) -> decltype(vis(0))
Definition format.h:3885
Parsing context consisting of a format string range being parsed and an argument counter for automati...
Definition base.h:857
string_buffer()
Definition format.h:958
auto str() -> std::string &
Definition format.h:961
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:944
writer(detail::buffer< char > &buf)
Definition format.h:940
writer(FILE *f)
Definition format.h:939
FMT_API auto get_cached_power(int k) noexcept -> uint128_fallback
Definition format-inl.h:1141
auto floor_log10_pow2(int e) noexcept -> int
Definition format.h:1417
auto floor_log2_pow10(int e) noexcept -> int
Definition format.h:1423
FMT_API auto to_decimal(T x) noexcept -> decimal_fp< T >
Definition format-inl.h:1258
auto umul128_upper64(uint64_t x, uint64_t y) noexcept -> uint64_t
Definition format.h:1429
auto umul192_upper128(uint64_t x, uint128_fallback y) noexcept -> uint128_fallback
Definition format.h:1442
Converts a string literal into a format string that will be parsed at compile time and converted into...
Definition printf.h:50
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:1022
FMT_CONSTEXPR auto display_width_of(uint32_t cp) noexcept -> size_t
Definition format.h:670
uint128_t uintptr_t
Definition format.h:422
FMT_CONSTEXPR auto code_point_length(const Char *begin) -> int
Definition base.h:1313
auto get_iterator(Buf &buf, OutputIt) -> decltype(buf.out())
Definition base.h:2141
constexpr auto digits10< int128_opt >() noexcept -> int
Definition format.h:1156
FMT_CONSTEXPR FMT_NOINLINE auto write_int_noinline(OutputIt out, write_int_arg< T > arg, const format_specs &specs) -> OutputIt
Definition format.h:2126
FMT_CONSTEXPR20 auto isfinite(T value) -> bool
Definition format.h:2629
struct detail::fixed_string deallocate
basic_fp< unsigned long long > fp
Definition format.h:1611
FMT_CONSTEXPR auto do_format_base2e(int base_bits, Char *out, UInt value, int size, bool upper=false) -> Char *
Definition format.h:1263
FMT_CONSTEXPR auto compare(const Char *s1, const Char *s2, size_t n) -> int
Definition base.h:474
conditional_t< long_short, int, long long > long_type
Definition base.h:1136
FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs &specs, size_t size, size_t width, F &&f) -> OutputIt
Definition format.h:1687
constexpr auto to_ascii(Char c) -> char
Definition base.h:1307
constexpr auto fractional_part_rounding_thresholds(int index) -> uint32_t
Definition format.h:3134
FMT_CONSTEXPR20 auto bit_cast(const From &from) -> To
Definition format.h:280
FMT_CONSTEXPR FMT_NOINLINE auto fill(OutputIt it, size_t n, const basic_specs &specs) -> OutputIt
Definition format.h:1672
FMT_CONSTEXPR auto operator*(fp x, fp y) -> fp
Definition format.h:1649
FMT_CONSTEXPR void ignore_unused(const T &...)
Definition base.h:361
auto decimal_point(locale_ref loc) -> Char
Definition format.h:1178
FMT_INLINE void assume(bool condition)
Definition format.h:479
constexpr auto num_bits< uint128_fallback >() -> int
Definition format.h:436
constexpr auto use_fixed(int exp, int exp_upper) -> bool
Definition format.h:2479
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:702
void(*)(detail::buffer< char > &, int, const char *) format_func
Definition format.h:3808
constexpr auto has_implicit_bit() -> bool
Definition format.h:1503
constexpr auto num_bits() -> int
Definition format.h:430
uint128_opt
Definition base.h:414
FMT_CONSTEXPR void prefix_append(unsigned &prefix, unsigned value)
Definition format.h:1932
auto is_big_endian() -> bool
Definition format.h:290
FMT_CONSTEXPR auto count_digits_fallback(T n) -> int
Definition format.h:1053
conditional_t< FMT_USE_INT128, uint128_opt, uint128_fallback > uint128_t
Definition format.h:417
FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, const format_specs &specs={}) -> OutputIt
Definition format.h:1714
constexpr auto digits10() noexcept -> int
Definition format.h:1153
dragon
Definition format.h:2904
@ fixup
Definition format.h:2906
@ predecessor_closer
Definition format.h:2905
@ fixed
Definition format.h:2907
conditional_t< long_short, unsigned, unsigned long long > ulong_type
Definition base.h:1137
FMT_API void print(FILE *, string_view)
constexpr auto digits10< uint128_t >() noexcept -> int
Definition format.h:1157
FMT_INLINE auto umul128(uint64_t x, uint64_t y) noexcept -> uint128_fallback
Definition format.h:1386
FMT_CONSTEXPR20 void adjust_precision(int &precision, int exp10)
Definition format.h:2655
constexpr auto max_value() -> T
Definition format.h:427
int128_opt
Definition base.h:413
FMT_CONSTEXPR auto make_write_int_arg(T value, sign s) -> write_int_arg< uint32_or_64_or_128_t< T > >
Definition format.h:2005
FMT_CONSTEXPR auto to_unsigned(Int value) -> make_unsigned_t< Int >
Definition base.h:439
FMT_END_EXPORT auto equal2(const Char *lhs, const char *rhs) -> bool
Definition format.h:1197
constexpr FMT_INLINE_VARIABLE uint32_t invalid_code_point
Definition format.h:631
constexpr Char string_literal< Char, C... >::value[sizeof...(C)]
Definition format.h:275
auto write_ptr(OutputIt out, UIntPtr value, const format_specs *specs) -> OutputIt
Definition format.h:1724
auto write_int(OutputIt out, UInt value, unsigned prefix, const format_specs &specs, const digit_grouping< Char > &grouping) -> OutputIt
Definition format.h:1939
auto base_iterator(OutputIt it, typename OutputIt::container_type::value_type *) -> OutputIt
Definition format.h:543
constexpr auto to_pointer(OutputIt, size_t) -> T *
Definition format.h:522
auto write_loc(OutputIt, const loc_value &, const format_specs &, locale_ref) -> bool
Definition format.h:1994
to_utf8_error_policy
Definition format.h:1314
@ abort
Definition format.h:1314
@ replace
Definition format.h:1314
FMT_API void format_error_code(buffer< char > &out, int error_code, string_view message) noexcept
Definition format-inl.h:73
auto digits2(size_t value) -> const char *
Definition format.h:1036
FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP &f, const format_specs &specs, sign s, int exp_upper, locale_ref loc) -> OutputIt
Definition format.h:2604
conditional_t< std::is_same< T, float >::value||doublish, double, T > convert_float_result
Definition format.h:1654
FMT_CONSTEXPR auto multiply(uint64_t lhs, uint64_t rhs) -> uint64_t
Definition format.h:1632
@ use_utf8
Definition base.h:459
FMT_API auto is_printable(uint32_t cp) -> bool
Definition format-inl.h:1794
FMT_CONSTEXPR20 void format_hexfloat(Float value, format_specs specs, buffer< char > &buf)
Definition format.h:3049
FMT_CONSTEXPR FMT_NOINLINE auto copy_noinline(InputIt begin, InputIt end, OutputIt out) -> OutputIt
Definition format.h:572
constexpr auto is_constant_evaluated(bool default_value=false) noexcept -> bool
Definition base.h:363
FMT_API auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result< Char >
Definition format-inl.h:113
template FMT_API auto thousands_sep_impl< wchar_t >(locale_ref) -> thousands_sep_result< wchar_t >
auto write_escaped_char(OutputIt out, Char v) -> OutputIt
Definition format.h:1842
constexpr auto num_bits< int128_opt >() -> int
Definition format.h:434
auto thousands_sep(locale_ref loc) -> thousands_sep_result< Char >
Definition format.h:1167
FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T &value) -> OutputIt
Definition format.h:557
FMT_ALWAYS_INLINE constexpr auto const_check(T val) -> T
Definition base.h:380
constexpr auto exponent_bias() -> int
Definition format.h:1524
constexpr auto num_significand_bits() -> int
Definition format.h:1510
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:1443
bool_constant< std::is_same< T, int >::value||FMT_BUILTIN_TYPES > is_builtin
Definition format.h:3647
FMT_API auto write_console(int fd, string_view text) -> bool
Definition format-inl.h:1695
FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt
Definition base.h:2083
remove_reference_t< decltype(reserve(std::declval< OutputIt & >(), 0))> reserve_iterator
Definition format.h:518
FMT_CONSTEXPR auto write_exponent(int exp, OutputIt out) -> OutputIt
Definition format.h:1539
FMT_CONSTEXPR auto utf8_decode(const char *s, uint32_t *c, int *e) -> const char *
Definition format.h:594
FMT_CONSTEXPR void abort_fuzzing_if(bool condition)
Definition format.h:252
FMT_FUNC void vformat_to(buffer< char > &buf, string_view fmt, format_args args, locale_ref loc)
Definition format-inl.h:1451
constexpr auto getsign(sign s) -> Char
Definition format.h:1048
std::integral_constant< bool, std::numeric_limits< T >::is_signed|| std::is_same< T, int128_opt >::value > is_signed
Definition format.h:697
FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, format_specs specs, sign s) -> OutputIt
Definition format.h:2348
constexpr auto write_significand(OutputIt out, const char *significand, int significand_size) -> OutputIt
Definition format.h:2382
auto write_escaped_cp(OutputIt out, const find_escape_result< Char > &escape) -> OutputIt
Definition format.h:1789
FMT_CONSTEXPR auto parse_align(const Char *begin, const Char *end, format_specs &specs) -> const Char *
Definition format.h:2312
constexpr auto get_significand_size(const big_decimal_fp &f) -> int
Definition format.h:2373
FMT_CONSTEXPR auto format_base2e(int base_bits, Char *out, UInt value, int num_digits, bool upper=false) -> Char *
Definition format.h:1277
FMT_CONSTEXPR auto write_char(OutputIt out, Char value, const format_specs &specs) -> OutputIt
Definition format.h:1858
FMT_CONSTEXPR auto compute_exp_size(int exp) -> int
Definition format.h:1530
auto needs_escape(uint32_t cp) -> bool
Definition format.h:1740
constexpr auto convert_float(T value) -> convert_float_result< T >
Definition format.h:1658
auto write_codepoint(OutputIt out, char prefix, uint32_t cp) -> OutputIt
Definition format.h:1779
constexpr auto set(type rhs) -> int
Definition base.h:1039
FMT_INLINE FMT_CONSTEXPR auto signbit(T value) -> bool
Definition format.h:2643
constexpr auto to_string_view(const Char *s) -> basic_string_view< Char >
Definition base.h:958
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:3712
conditional_t< num_bits< T >()<=64, uint64_t, uint128_t > uint64_or_128_t
Definition format.h:1027
state
Definition base.h:1467
@ precision
Definition base.h:1467
@ width
Definition base.h:1467
FMT_CONSTEXPR void for_each_codepoint(string_view s, F f)
Definition format.h:636
constexpr friend auto operator==(allocator, allocator) noexcept -> bool
Definition format.h:758
FMT_CONSTEVAL auto exp_upper() -> int
Definition format.h:2471
FMT_CONSTEXPR20 auto reserve(OutputIt it, size_t n) -> typename OutputIt::value_type *
Definition format.h:497
constexpr friend auto operator!=(allocator, allocator) noexcept -> bool
Definition format.h:761
FMT_EXPORT constexpr auto compile_string_to_view(const Char(&s)[N]) -> basic_string_view< Char >
Definition format.h:996
FMT_CONSTEXPR20 auto countl_zero_fallback(UInt n) -> int
Definition format.h:458
constexpr auto is_negative(T value) -> bool
Definition format.h:1011
FMT_CONSTEXPR FMT_INLINE auto write(basic_appender< Char > out, T value, const format_specs &specs, locale_ref loc) -> basic_appender< Char >
Definition format.h:2137
std::is_same< T, float128 > is_float128
Definition format.h:723
FMT_API void do_report_error(format_func func, int error_code, const char *message) noexcept
Definition format-inl.h:96
@ int_type
Definition base.h:988
@ string_type
Definition base.h:1003
auto get_buffer(OutputIt out) -> iterator_buffer< OutputIt, T >
Definition base.h:2131
auto find_escape(const Char *begin, const Char *end) -> find_escape_result< Char >
Definition format.h:1753
FMT_CONSTEXPR20 auto format_float(Float value, int precision, const format_specs &specs, bool binary32, buffer< char > &buf) -> int
Definition format.h:3146
FMT_CONSTEXPR20 FMT_INLINE void write2digits(Char *out, size_t value)
Definition format.h:1206
constexpr auto num_bits< uint128_opt >() -> int
Definition format.h:435
constexpr auto count() -> int
Definition base.h:1081
FMT_CONSTEXPR20 auto do_format_decimal(Char *out, UInt value, int size) -> Char *
Definition format.h:1219
FMT_API auto decimal_point_impl(locale_ref loc) -> Char
Definition format-inl.h:120
FMT_CONSTEXPR auto maybe_set_debug_format(Formatter &f, bool set) -> decltype(f.set_debug_format(set))
Definition format.h:767
FMT_CONSTEXPR20 auto count_digits(uint64_t n) -> int
Definition format.h:1096
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:445
constexpr auto exponent_mask() -> typename dragonbox::float_info< Float >::carrier_uint
Definition format.h:1518
auto select(T true_value, F) -> T
Definition format.h:1663
FMT_CONSTEXPR FMT_INLINE auto format_decimal(Char *out, UInt value, int num_digits) -> Char *
Definition format.h:1241
FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP &f, const format_specs &specs, sign s, int exp_upper, locale_ref loc) -> OutputIt
Definition format.h:2565
FMT_CONSTEXPR20 auto countl_zero(uint32_t n) -> int
Definition format.h:465
FMT_CONSTEXPR20 void format_dragon(basic_fp< uint128_t > value, unsigned flags, int num_digits, buffer< char > &buf, int &exp10)
Definition format.h:2913
auto write_escaped_string(OutputIt out, basic_string_view< Char > str) -> OutputIt
Definition format.h:1826
FMT_CONSTEXPR20 auto get_container(OutputIt it) -> typename OutputIt::container_type &
Definition base.h:502
FMT_CONSTEXPR20 auto write_fixed(OutputIt out, const DecimalFP &f, int significand_size, Char decimal_point, const format_specs &specs, sign s, locale_ref loc={}) -> OutputIt
Definition format.h:2499
FMT_CONSTEXPR auto normalize(basic_fp< F > value) -> basic_fp< F >
Definition format.h:1615
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:1471
constexpr auto isnan(T value) -> bool
Definition format.h:2616
constexpr auto format_as(Enum e) noexcept -> underlying_t< Enum >
Definition format.h:3995
Definition StringMap.hpp:773
bytes(string_view s)
Definition format.h:4016
string_view data
Definition format.h:4014
FMT_CONSTEXPR basic_fp(Float n)
Definition format.h:1576
constexpr basic_fp(uint64_t f_val, int e_val)
Definition format.h:1573
FMT_CONSTEXPR auto assign(Float n) -> bool
Definition format.h:1580
constexpr basic_fp()
Definition format.h:1572
int e
Definition format.h:1567
static constexpr int num_significand_bits
Definition format.h:1569
unsigned long long f
Definition format.h:1566
const char * significand
Definition format.h:2368
int significand_size
Definition format.h:2369
int exponent
Definition format.h:2370
int exponent
Definition format.h:1496
significand_type significand
Definition format.h:1495
typename float_info< T >::carrier_uint significand_type
Definition format.h:1494
detail::uint128_t carrier_uint
Definition format.h:1490
detail::uint128_t carrier_uint
Definition format.h:1483
static const int exponent_bits
Definition format.h:1484
static const int min_k
Definition format.h:1472
static const int big_divisor
Definition format.h:1470
static const int shorter_interval_tie_upper_threshold
Definition format.h:1475
static const int shorter_interval_tie_lower_threshold
Definition format.h:1474
static const int max_k
Definition format.h:1473
uint64_t carrier_uint
Definition format.h:1467
static const int kappa
Definition format.h:1469
static const int exponent_bits
Definition format.h:1468
static const int small_divisor
Definition format.h:1471
static const int shorter_interval_tie_lower_threshold
Definition format.h:1462
static const int small_divisor
Definition format.h:1459
static const int max_k
Definition format.h:1461
static const int kappa
Definition format.h:1457
static const int shorter_interval_tie_upper_threshold
Definition format.h:1463
uint32_t carrier_uint
Definition format.h:1455
static const int big_divisor
Definition format.h:1458
static const int exponent_bits
Definition format.h:1456
static const int min_k
Definition format.h:1460
FMT_CONSTEXPR auto operator()(T) -> unsigned long long
Definition format.h:3705
FMT_CONSTEXPR auto operator()(T value) -> unsigned long long
Definition format.h:3700
const Char * end
Definition format.h:1748
const Char * begin
Definition format.h:1747
uint32_t cp
Definition format.h:1749
Char data[N]
Definition format.h:991
FMT_CONSTEXPR20 fixed_string(const Char(&s)[N])
Definition format.h:987
FMT_ASSERT(n<=max_value< size_t >()/sizeof(T), "")
T * p
Definition format.h:751
std::string grouping
Definition format.h:2023
auto operator()(T value) -> bool
Definition format.h:2027
auto operator()(T) -> bool
Definition format.h:2035
std::basic_string< Char > decimal_point
Definition format.h:2024
const format_specs & specs
Definition format.h:2021
std::basic_string< Char > sep
Definition format.h:2022
basic_appender< Char > out
Definition format.h:2020
FMT_CONSTEXPR size_padding(int num_digits, unsigned prefix, const format_specs &specs)
Definition format.h:2045
unsigned padding
Definition format.h:2043
unsigned size
Definition format.h:2042
static constexpr Char value[sizeof...(C)]
Definition format.h:268
Char thousands_sep
Definition format.h:1161
std::string grouping
Definition format.h:1160
const Char * str
Definition format.h:3752
auto operator=(T &&value) const -> named_arg< Char, T >
Definition format.h:3754
unsigned prefix
Definition format.h:2001
UInt abs_value
Definition format.h:2000
T value
Definition format.h:4042
const T * value
Definition format.h:4085
const formatter< T, Char > * fmt
Definition format.h:4084
void pointer
Definition format.h:167
void reference
Definition format.h:168
output_iterator_tag iterator_category
Definition format.h:163
decltype(static_cast< int * >(nullptr) - static_cast< int * >(nullptr)) difference_type
Definition format.h:165
T value_type
Definition format.h:164
int index
Definition base.h:1293
basic_string_view< Char > name
Definition base.h:1294