|
Loading...
Searching...
No Matches
Go to the documentation of this file.
8#ifndef FMT_FORMAT_INL_H_
9#define FMT_FORMAT_INL_H_
20#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
25# if !defined(FMT_HEADER_ONLY) && !defined(WIN32_LEAN_AND_MEAN)
26# define WIN32_LEAN_AND_MEAN
28# if defined(NOMINMAX) || defined(FMT_WIN_MINMAX)
39# define FMT_CATCH(x) catch (x)
41# define FMT_TRY if (true)
42# define FMT_CATCH(x) if (false)
47# pragma warning(disable : 4702)
52inline fmt::internal::null<> strerror_r( int, char*, ...) { return {}; }
53inline fmt::internal::null<> strerror_s( char*, std::size_t, ...) { return {}; }
59 print(stderr, "{}:{}: assertion failed: {}", file, line, message);
64# define FMT_SNPRINTF snprintf
66inline int fmt_snprintf( char* buffer, size_t size, const char* format, ...) {
69 int result = vsnprintf_s(buffer, size, _TRUNCATE, format, args);
73# define FMT_SNPRINTF fmt_snprintf
95 std::size_t buffer_size_;
98 void operator=( const dispatcher&) {}
101 int handle( int result) {
103 return result == -1 ? errno : result;
107 int handle( char* message) {
109 if (message == buffer_ && strlen(buffer_) == buffer_size_ - 1)
117 return fallback( strerror_s(buffer_, buffer_size_, error_code_));
121 int fallback( int result) {
123 return result == 0 && strlen(buffer_) == buffer_size_ - 1 ? ERANGE
131 buffer_ = strerror(error_code_);
137 dispatcher( int err_code, char*& buf, std::size_t buf_size)
138 : error_code_(err_code), buffer_(buf), buffer_size_(buf_size) {}
140 int run() { return handle( strerror_r(error_code_, buffer_, buffer_size_)); }
151 static const char SEP[] = ": ";
152 static const char ERROR_STR[] = "error ";
154 std::size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2;
157 abs_value = 0 - abs_value;
174 size_t written = std::fwrite( ptr, size, count, stream);
175 if (written < count) {
185 (void)std::fwrite(full_message. data(), full_message. size(), 1, stderr);
186 std::fputc( '\n', stderr);
190#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
193template < typename Locale>
195 static_assert(std::is_same<Locale, std::locale>::value, "");
199 static_assert(std::is_same<Locale, std::locale>::value, "");
200 return locale_ ? * static_cast<const std::locale* >( locale_) : std::locale();
204 return std::use_facet<std::numpunct<Char>>(loc. get<std::locale>()).grouping();
207 return std::use_facet<std::numpunct<Char>>(loc. get<std::locale>())
211 return std::use_facet<std::numpunct<Char>>(loc. get<std::locale>())
216template < typename Char>
220template < typename Char>
222 return FMT_STATIC_THOUSANDS_SEPARATOR;
224template < typename Char>
235 error_code_ = err_code;
238 std::runtime_error& base = * this;
239 base = std::runtime_error( to_string(buffer));
246 int i = static_cast<int>( sizeof( void*)) - 1;
247 while (i > 0 && n. value[i] == 0) --i;
248 auto char_digits = std::numeric_limits<unsigned char>::digits / 4;
249 return i >= 0 ? i * char_digits + count_digits<4, unsigned>(n. value[i]) : 1;
254 "0001020304050607080910111213141516171819"
255 "2021222324252627282930313233343536373839"
256 "4041424344454647484950515253545556575859"
257 "6061626364656667686970717273747576777879"
258 "8081828384858687888990919293949596979899";
263#define FMT_POWERS_OF_10(factor) \
264 factor * 10, (factor)*100, (factor)*1000, (factor)*10000, (factor)*100000, \
265 (factor)*1000000, (factor)*10000000, (factor)*100000000, \
271 10000000000000000000ULL};
280 10000000000000000000ULL};
286 0xfa8fd5a0081c0288, 0xbaaee17fa23ebf76, 0x8b16fb203055ac76,
287 0xcf42894a5dce35ea, 0x9a6bb0aa55653b2d, 0xe61acf033d1a45df,
288 0xab70fe17c79ac6ca, 0xff77b1fcbebcdc4f, 0xbe5691ef416bd60c,
289 0x8dd01fad907ffc3c, 0xd3515c2831559a83, 0x9d71ac8fada6c9b5,
290 0xea9c227723ee8bcb, 0xaecc49914078536d, 0x823c12795db6ce57,
291 0xc21094364dfb5637, 0x9096ea6f3848984f, 0xd77485cb25823ac7,
292 0xa086cfcd97bf97f4, 0xef340a98172aace5, 0xb23867fb2a35b28e,
293 0x84c8d4dfd2c63f3b, 0xc5dd44271ad3cdba, 0x936b9fcebb25c996,
294 0xdbac6c247d62a584, 0xa3ab66580d5fdaf6, 0xf3e2f893dec3f126,
295 0xb5b5ada8aaff80b8, 0x87625f056c7c4a8b, 0xc9bcff6034c13053,
296 0x964e858c91ba2655, 0xdff9772470297ebd, 0xa6dfbd9fb8e5b88f,
297 0xf8a95fcf88747d94, 0xb94470938fa89bcf, 0x8a08f0f8bf0f156b,
298 0xcdb02555653131b6, 0x993fe2c6d07b7fac, 0xe45c10c42a2b3b06,
299 0xaa242499697392d3, 0xfd87b5f28300ca0e, 0xbce5086492111aeb,
300 0x8cbccc096f5088cc, 0xd1b71758e219652c, 0x9c40000000000000,
301 0xe8d4a51000000000, 0xad78ebc5ac620000, 0x813f3978f8940984,
302 0xc097ce7bc90715b3, 0x8f7e32ce7bea5c70, 0xd5d238a4abe98068,
303 0x9f4f2726179a2245, 0xed63a231d4c4fb27, 0xb0de65388cc8ada8,
304 0x83c7088e1aab65db, 0xc45d1df942711d9a, 0x924d692ca61be758,
305 0xda01ee641a708dea, 0xa26da3999aef774a, 0xf209787bb47d6b85,
306 0xb454e4a179dd1877, 0x865b86925b9bc5c2, 0xc83553c5c8965d3d,
307 0x952ab45cfa97a0b3, 0xde469fbd99a05fe3, 0xa59bc234db398c25,
308 0xf6c69a72a3989f5c, 0xb7dcbf5354e9bece, 0x88fcf317f22241e2,
309 0xcc20ce9bd35c78a5, 0x98165af37b2153df, 0xe2a0b5dc971f303a,
310 0xa8d9d1535ce3b396, 0xfb9b7cd9a4a7443c, 0xbb764c4ca7a44410,
311 0x8bab8eefb6409c1a, 0xd01fef10a657842c, 0x9b10a4e5e9913129,
312 0xe7109bfba19c0c9d, 0xac2820d9623bf429, 0x80444b5e7aa7cf85,
313 0xbf21e44003acdd2d, 0x8e679c2f5e44ff8f, 0xd433179d9c8cb841,
314 0x9e19db92b4e31ba9, 0xeb96bf6ebadf77d9, 0xaf87023b9bf0ee6b,
321 -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, -954,
322 -927, -901, -874, -847, -821, -794, -768, -741, -715, -688, -661,
323 -635, -608, -582, -555, -529, -502, -475, -449, -422, -396, -369,
324 -343, -316, -289, -263, -236, -210, -183, -157, -130, -103, -77,
325 -50, -24, 3, 30, 56, 83, 109, 136, 162, 189, 216,
326 242, 269, 295, 322, 348, 375, 402, 428, 455, 481, 508,
327 534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800,
328 827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066};
338template < typename T> struct bits {
340 static_cast<int>( sizeof(T) * std::numeric_limits<unsigned char>::digits);
363 std::numeric_limits<double>::digits - 1;
375 fp(uint64_t f_val, int e_val) : f(f_val), e(e_val) {}
379 template < typename Double> explicit fp(Double d) { assign(d); }
385 while (( value.f & shifted_implicit_bit) == 0) {
398 template < typename Double, FMT_ENABLE_IF(sizeof(Double) == sizeof(u int64_t))>
401 using limits = std::numeric_limits<Double>;
402 const int exponent_size =
405 const uint64_t exponent_mask = (~0ULL >> 1) & ~significand_mask;
406 const int exponent_bias = (1 << exponent_size) - limits::max_exponent - 1;
407 auto u = bit_cast<uint64_t>(d);
408 f = u & significand_mask;
412 bool is_predecessor_closer = f == 0 && biased_e > 1;
418 return is_predecessor_closer;
421 template < typename Double, FMT_ENABLE_IF(sizeof(Double) != sizeof(u int64_t))>
432 bool is_lower_closer = assign(d);
434 is_lower_closer ? fp(( f << 2) - 1, e - 2) : fp(( f << 1) - 1, e - 1);
436 fp upper = normalize<1>( fp(( f << 1) + 1, e - 1));
437 lower. f <<= lower. e - upper. e;
443 constexpr int min_normal_e = std::numeric_limits<float>::min_exponent -
444 std::numeric_limits<double>::digits;
446 std::numeric_limits<float>::digits - 1);
447 if (min_normal_e > e) half_ulp <<= min_normal_e - e;
448 fp upper = normalize<0>( fp( f + half_ulp, e));
451 lower. f <<= lower. e - upper. e;
459inline uint64_t multiply(uint64_t lhs, uint64_t rhs) {
461 auto product = static_cast<__uint128_t >(lhs) * rhs;
462 auto f = static_cast<uint64_t >(product >> 64);
463 return ( static_cast<uint64_t >(product) & (1ULL << 63)) != 0 ? f + 1 : f;
466 uint64_t mask = (1ULL << 32) - 1;
467 uint64_t a = lhs >> 32, b = lhs & mask;
468 uint64_t c = rhs >> 32, d = rhs & mask;
469 uint64_t ac = a * c, bc = b * c, ad = a * d, bd = b * d;
471 uint64_t mid = (bd >> 32) + (ad & mask) + (bc & mask) + (1U << 31);
472 return ac + (ad >> 32) + (bc >> 32) + (mid >> 32);
481 const uint64_t one_over_log2_10 = 0x4d104d42;
482 int index = static_cast<int>(
483 static_cast<int64_t >(
485 ((uint64_t(1) << 32) - 1)
490 const int first_dec_exp = -348;
492 const int dec_exp_step = 8;
493 index = ( index - first_dec_exp - 1) / dec_exp_step + 1;
494 pow10_exponent = first_dec_exp + index * dec_exp_step;
505 explicit operator uint32_t() const { return static_cast<uint32_t >( lower); }
551 for ( int j = 0, n = static_cast<int>(other. bigits_. size()); j != n;
562 for ( size_t i = 0, n = bigits_. size(); i < n; ++i) {
575 for ( size_t i = 0, n = bigits_. size(); i < n; ++i) {
618 if (shift == 0) return * this;
620 for ( size_t i = 0, n = bigits_. size(); i < n; ++i) {
637 if (num_lhs_bigits != num_rhs_bigits)
638 return num_lhs_bigits > num_rhs_bigits ? 1 : -1;
642 if (end < 0) end = 0;
643 for (; i >= end; --i, --j) {
645 if (lhs_bigit != rhs_bigit) return lhs_bigit > rhs_bigit ? 1 : -1;
647 if (i != j) return i > j ? 1 : -1;
656 if (max_lhs_bigits + 1 < num_rhs_bigits) return -1;
657 if (max_lhs_bigits > num_rhs_bigits) return 1;
658 auto get_bigit = []( const bigint& n, int i) -> bigit {
662 int min_exp = (std::min)((std::min)(lhs1. exp_, lhs2. exp_), rhs. exp_);
663 for ( int i = num_rhs_bigits - 1; i >= min_exp; --i) {
665 static_cast<double_bigit>(get_bigit(lhs1, i)) + get_bigit(lhs2, i);
666 bigit rhs_bigit = get_bigit(rhs, i);
667 if (sum > rhs_bigit + borrow) return 1;
668 borrow = rhs_bigit + borrow - sum;
669 if (borrow > 1) return -1;
672 return borrow != 0 ? -1 : 0;
681 while ( exp >= bitmask) bitmask <<= 1;
687 while (bitmask != 0) {
689 if (( exp & bitmask) != 0) * this *= 5;
701 auto sum = accumulator_t();
702 for ( int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) {
705 for ( int i = 0, j = bigit_index; j >= 0; ++i, --j) {
713 for ( int bigit_index = num_bigits; bigit_index < num_result_bigits;
729 if ( compare(* this, divisor) < 0) return 0;
732 int exp_difference = exp_ - divisor. exp_;
733 if (exp_difference > 0) {
736 for ( int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j)
738 std::uninitialized_fill_n( bigits_. data(), exp_difference, 0);
739 exp_ -= exp_difference;
745 } while ( compare(* this, divisor) >= 0);
762 if (remainder <= divisor - remainder && error * 2 <= divisor - remainder * 2)
765 if (remainder >= error &&
766 remainder - error >= divisor - (remainder - error)) {
783template < typename Handler>
785 int& exp, Handler& handler) {
790 auto integral = static_cast<uint32_t >( value.f >> -one. e);
794 uint64_t fractional = value.f & (one. f - 1);
803 auto divmod_integral = [&](uint32_t divisor) {
804 digit = integral / divisor;
811 divmod_integral(1000000000);
814 divmod_integral(100000000);
817 divmod_integral(10000000);
820 divmod_integral(1000000);
823 divmod_integral(100000);
826 divmod_integral(10000);
829 divmod_integral(1000);
832 divmod_integral(100);
842 FMT_ASSERT( false, "invalid number of digits");
846 ( static_cast<uint64_t >(integral) << -one. e) + fractional;
847 result = handler.on_digit( static_cast<char>( '0' + digit),
857 static_cast<char>( '0' + static_cast<char>(fractional >> -one. e));
858 fractional &= one. f - 1;
860 result = handler.on_digit(digit, one. f, fractional, error, exp, false);
891 uint64_t error, int, bool integral) {
899 if (error >= divisor || error >= divisor - error) return digits::error;
906 for ( int i = size - 1; i > 0 && buf[i] > '9'; --i) {
930 void round(uint64_t d, uint64_t divisor, uint64_t& remainder,
933 remainder < d && error - remainder >= divisor &&
934 (remainder + divisor < d || d - remainder >= remainder + divisor - d)) {
936 remainder += divisor;
942 uint64_t error, int exp, bool integral) {
946 uint64_t up = ( diff - 1) * unit;
947 round( up, divisor, remainder, error);
949 if (remainder < down && error - remainder >= divisor &&
950 (remainder + divisor < down ||
951 down - remainder > remainder + divisor - down)) {
954 return 2 * unit <= remainder && remainder <= error - 4 * unit
963template < typename Double>
976 int shift = value.assign(d) ? 2 : 1;
977 uint64_t significand = value.f << shift;
985 upper_store <<= value.e + 1;
986 upper = &upper_store;
990 } else if (exp10 < 0) {
996 upper = &upper_store;
1007 upper_store. assign(1ULL << 1);
1008 upper = &upper_store;
1011 if (!upper) upper = &lower;
1013 bool even = ( value.f & 1) == 0;
1018 bool low = compare( numerator, lower) - even < 0;
1021 data[num_digits++] = static_cast<char>( '0' + digit);
1024 ++ data[num_digits - 1];
1028 if (result > 0 || (result == 0 && (digit % 2) != 0))
1029 ++ data[num_digits - 1];
1032 exp10 -= num_digits - 1;
1037 if (upper != &lower) *upper *= 10;
1044template < typename T>
1046 static_assert(!std::is_same<T, float>(), "");
1051 if (precision <= 0 || ! fixed) {
1056 std::uninitialized_fill_n(buf. data(), precision, '0');
1063 const int min_exp = -60;
1064 int cached_exp10 = 0;
1065 if (precision != -1) {
1070 normalized = normalized * cached_pow;
1074 int num_digits = handler.size;
1077 while (num_digits > 0 && buf[num_digits - 1] == '0') {
1094 fp_value = fp_value * cached_pow;
1097 assert(min_exp <= fp_value. e && fp_value. e <= -32);
1107 exp += handler.size - cached_exp10 - 1;
1113 return exp - cached_exp10;
1116template < typename T>
1121 static_assert(!std::is_same<T, float>(), "");
1127 precision = (precision >= 0 ? precision : 6) - 1;
1130 enum { max_format_size = 7 };
1131 char format[max_format_size];
1132 char* format_ptr = format;
1133 *format_ptr++ = '%';
1135 if (precision >= 0) {
1136 *format_ptr++ = '.';
1137 *format_ptr++ = '*';
1139 if (std::is_same<T, long double>()) *format_ptr++ = 'L';
1142 : (specs. upper ? 'A' : 'a');
1146 auto offset = buf. size();
1148 auto begin = buf. data() + offset;
1149 auto capacity = buf. capacity() - offset;
1150#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
1151 if (precision > 100000)
1152 throw std::runtime_error(
1153 "fuzz mode - avoid large allocation inside snprintf");
1157 int result = precision >= 0
1158 ? snprintf_ptr(begin, capacity, format, precision, value)
1166 if (size >= capacity) {
1167 buf. reserve(size + offset + 1);
1170 auto is_digit = []( char c) { return c >= '0' && c <= '9'; };
1172 if (precision == 0) {
1177 auto end = begin + size, p = end;
1180 } while (is_digit(*p));
1181 int fraction_size = static_cast<int>(end - p - 1);
1182 std::memmove(p, p + 1, fraction_size);
1184 return -fraction_size;
1187 buf. resize(size + offset);
1191 auto end = begin + size, exp_pos = end;
1194 } while (*exp_pos != 'e');
1195 char sign = exp_pos[1];
1196 assert( sign == '+' || sign == '-');
1198 auto p = exp_pos + 2;
1200 assert(is_digit(*p));
1201 exp = exp * 10 + (*p++ - '0');
1204 int fraction_size = 0;
1205 if (exp_pos != begin + 1) {
1207 auto fraction_end = exp_pos - 1;
1208 while (*fraction_end == '0') --fraction_end;
1210 fraction_size = static_cast<int>(fraction_end - begin - 1);
1211 std::memmove(begin + 1, begin + 2, fraction_size);
1213 buf. resize(fraction_size + offset + 1);
1214 return exp - fraction_size;
1226 auto out = ctx. out();
1229 auto value = n. bigits_[i - 1];
1243#if FMT_USE_WINDOWS_H
1246 static const char ERROR_MSG[] = "cannot convert string from UTF-8 to UTF-16";
1247 if (s. size() > INT_MAX)
1248 FMT_THROW(windows_error(ERROR_INVALID_PARAMETER, ERROR_MSG));
1249 int s_size = static_cast<int>(s. size());
1257 int length = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s. data(),
1258 s_size, nullptr, 0);
1259 if (length == 0) FMT_THROW(windows_error(GetLastError(), ERROR_MSG));
1260 buffer_.resize(length + 1);
1261 length = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, s. data(), s_size,
1262 &buffer_[0], length);
1263 if (length == 0) FMT_THROW(windows_error(GetLastError(), ERROR_MSG));
1264 buffer_[length] = 0;
1270 "cannot convert string from UTF-16 to UTF-8"));
1275 if (s. size() > INT_MAX) return ERROR_INVALID_PARAMETER;
1276 int s_size = static_cast<int>(s. size());
1284 int length = WideCharToMultiByte(CP_UTF8, 0, s. data(), s_size, nullptr, 0,
1286 if (length == 0) return GetLastError();
1287 buffer_.resize(length + 1);
1288 length = WideCharToMultiByte(CP_UTF8, 0, s. data(), s_size, &buffer_[0],
1289 length, nullptr, nullptr);
1290 if (length == 0) return GetLastError();
1291 buffer_[length] = 0;
1297 error_code_ = err_code;
1299 internal::format_windows_error(buffer, err_code, vformat(format_str, args));
1300 std::runtime_error& base = * this;
1301 base = std::runtime_error( to_string(buffer));
1311 wchar_t* system_message = &buf[0];
1312 int result = FormatMessageW(
1313 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr,
1314 error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), system_message,
1315 static_cast<uint32_t >(buf. size()), nullptr);
1317 utf16_to_utf8 utf8_message;
1318 if (utf8_message.convert(system_message) == ERROR_SUCCESS) {
1322 w.write(utf8_message);
1327 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
1344 char* system_message = &buf[0];
1351 w. write(system_message);
1354 if (result != ERANGE)
1372#if FMT_USE_WINDOWS_H
1387 vprint(stdout, format_str, args);
1393# pragma warning(pop)
FMT_CONSTEXPR iterator begin() const FMT_NOEXCEPT
typename basic_string_view< Char >::iterator iterator
FMT_CONSTEXPR size_t size() const
FMT_CONSTEXPR const Char * data() const
basic_memory_buffer< bigit, bigits_capacity > bigits_
bigint & operator<<=(int shift)
bigint & operator*=(Int value)
void operator=(const bigint &)=delete
void assign_pow10(int exp)
void subtract_aligned(const bigint &other)
static FMT_CONSTEXPR_DECL const int bigit_bits
void assign(const bigint &other)
int divmod_assign(const bigint &divisor)
friend int compare(const bigint &lhs, const bigint &rhs)
void multiply(uint64_t value)
friend int add_compare(const bigint &lhs1, const bigint &lhs2, const bigint &rhs)
void multiply(uint32_t value)
void subtract_bigits(int index, bigit other, bigit &borrow)
bigint(const bigint &)=delete
void remove_leading_zeros()
void reserve(std::size_t new_capacity)
void push_back(const T &value)
void resize(std::size_t new_size)
std::size_t size() const FMT_NOEXCEPT
std::size_t capacity() const FMT_NOEXCEPT
static FMT_CONSTEXPR_DECL const int significand_size
static FMT_CONSTEXPR_DECL const uint64_t implicit_bit
static FMT_CONSTEXPR_DECL const int double_significand_size
friend fp normalize(fp value)
boundaries assign_float_with_boundaries(Double d)
uint64_t significand_type
boundaries assign_with_boundaries(Double d)
fp(uint64_t f_val, int e_val)
void vprint(std::FILE *f, const text_style &ts, const S &format, basic_format_args< buffer_context< Char > > args)
void print(std::FILE *f, const text_style &ts, const S &format_str, const Args &... args)
std::basic_string< Char > vformat(const text_style &ts, const S &format_str, basic_format_args< buffer_context< Char > > args)
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
#define FMT_ASSERT(condition, message)
basic_string_view< char > string_view
std::back_insert_iterator< Container > format_to(std::back_insert_iterator< Container > out, const S &format_str, Args &&... args)
#define FMT_BEGIN_NAMESPACE
typename std::conditional< B, T, F >::type conditional_t
#define FMT_END_NAMESPACE
#define FMT_CONSTEXPR_DECL
void fallback_format(Double d, buffer< char > &buf, int &exp10)
round_direction get_round_direction(uint64_t divisor, uint64_t remainder, uint64_t error)
void vformat_to(basic_memory_buffer< Char > &buf, const text_style &ts, basic_string_view< Char > format_str, basic_format_args< buffer_context< Char > > args)
int snprintf_float(T value, int precision, float_specs specs, buffer< char > &buf)
void(*)(internal::buffer< char > &, int, string_view) format_func
FMT_FUNC void report_error(format_func func, int error_code, string_view message) FMT_NOEXCEPT
FMT_API void assert_fail(const char *file, int line, const char *message)
FMT_FUNC int safe_strerror(int error_code, char *&buffer, std::size_t buffer_size) FMT_NOEXCEPT
FMT_FUNC fp get_cached_power(int min_exponent, int &pow10_exponent)
FMT_CONSTEXPR std::make_unsigned< Int >::type to_unsigned(Int value)
FMT_FUNC void fwrite_fully(const void *ptr, size_t size, size_t count, FILE *stream)
FMT_FUNC std::string grouping_impl(locale_ref loc)
int count_digits(uint64_t n)
FMT_CONSTEXPR bool is_negative(T value)
FMT_FUNC void format_error_code(internal::buffer< char > &out, int error_code, string_view message) FMT_NOEXCEPT
FMT_FUNC Char decimal_point_impl(locale_ref loc)
FMT_ALWAYS_INLINE digits::result grisu_gen_digits(fp value, uint64_t error, int &exp, Handler &handler)
uint64_t multiply(uint64_t lhs, uint64_t rhs)
conditional_t< std::numeric_limits< T >::digits<=32, uint32_t, conditional_t< std::numeric_limits< T >::digits<=64, uint64_t, uint128_t > > uint32_or_64_or_128_t
FMT_FUNC Char thousands_sep_impl(locale_ref loc)
int format_float(T value, int precision, float_specs specs, buffer< char > &buf)
bool operator==(fp x, fp y)
FMT_FUNC int count_digits< 4 >(internal::fallback_uintptr n)
Integer numerator(const Rational &r)
Integer denominator(const Rational &r)
void operator>>=(int shift)
void operator+=(uint64_t n)
static const uint32_t zero_or_powers_of_10_32[]
static const int16_t pow10_exponents[]
static const uint64_t zero_or_powers_of_10_64[]
static const char digits[]
static const uint64_t pow10_significands[]
static const char foreground_color[]
static const uint64_t powers_of_10_64[]
static const wchar_t wreset_color[5]
static const char reset_color[5]
static const char background_color[]
static const char hex_digits[]
static const char signs[]
FMT_NORETURN FMT_API void on_error(const char *message)
unsigned char value[sizeof(void *)]
digits::result on_digit(char digit, uint64_t divisor, uint64_t remainder, uint64_t error, int, bool integral)
digits::result on_start(uint64_t divisor, uint64_t remainder, uint64_t error, int &exp)
digits::result on_start(uint64_t, uint64_t, uint64_t, int &)
void round(uint64_t d, uint64_t divisor, uint64_t &remainder, uint64_t error)
digits::result on_digit(char digit, uint64_t divisor, uint64_t remainder, uint64_t error, int exp, bool integral)
|