MCPcopy Create free account
hub / github.com/ablab/spades / format_decimal

Method format_decimal

ext/include/cppformat/format.h:2286–2305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2284// write a terminating null character.
2285template <typename T>
2286inline void format_decimal(char *&buffer, T value) {
2287 typename internal::IntTraits<T>::MainType abs_value = value;
2288 if (internal::is_negative(value)) {
2289 *buffer++ = '-';
2290 abs_value = 0 - abs_value;
2291 }
2292 if (abs_value < 100) {
2293 if (abs_value < 10) {
2294 *buffer++ = static_cast<char>('0' + abs_value);
2295 return;
2296 }
2297 unsigned index = static_cast<unsigned>(abs_value * 2);
2298 *buffer++ = internal::DIGITS[index];
2299 *buffer++ = internal::DIGITS[index + 1];
2300 return;
2301 }
2302 unsigned num_digits = internal::count_digits(abs_value);
2303 internal::format_decimal(buffer, abs_value, num_digits);
2304 buffer += num_digits;
2305}
2306}
2307
2308#if FMT_GCC_VERSION

Callers

nothing calls this directly

Calls 3

count_digitsFunction · 0.85
is_negativeFunction · 0.70
format_decimalFunction · 0.70

Tested by

no test coverage detected