| 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 { |
nothing calls this directly
no test coverage detected