MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / write_decimal

Method write_decimal

extlibs/fmt/include/fmt/format.h:1469–1478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1467
1468 // Writes a decimal integer.
1469 template <typename Int> void write_decimal(Int value) {
1470 auto abs_value = static_cast<uint32_or_64_or_128_t<Int>>(value);
1471 bool negative = is_negative(value);
1472 // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer.
1473 if (negative) abs_value = ~abs_value + 1;
1474 int num_digits = count_digits(abs_value);
1475 auto&& it = reserve((negative ? 1 : 0) + static_cast<size_t>(num_digits));
1476 if (negative) *it++ = static_cast<char_type>('-');
1477 it = format_decimal<char_type>(it, abs_value, num_digits);
1478 }
1479
1480 // The handle_int_type_spec handler that writes an integer.
1481 template <typename Int, typename Specs> struct int_writer {

Callers

nothing calls this directly

Calls 3

is_negativeFunction · 0.85
count_digitsFunction · 0.70
reserveFunction · 0.70

Tested by

no test coverage detected