From d1e6f0f8c672b02fe559e8aa00621551a148052b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 20 May 2021 18:00:19 -0700 Subject: [PATCH] Fix binary size regression caused by b268f88 --- include/fmt/format.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 0478ba0c..de744b0f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -459,6 +459,12 @@ buffer_appender copy_str(InputIt begin, InputIt end, return out; } +template +FMT_NOINLINE OutputIt copy_str_noinline(InputIt begin, InputIt end, + OutputIt it) { + return copy_str(begin, end, it); +} + // A public domain branchless UTF-8 decoder by Christopher Wellons: // https://github.com/skeeto/branchless-utf8 /* Decode the next character, c, from s, reporting errors in e. @@ -1065,7 +1071,7 @@ inline format_decimal_result format_decimal(Iterator out, UInt value, // Buffer is large enough to hold all digits (digits10 + 1). Char buffer[digits10() + 1]; auto end = format_decimal(buffer, value, size).end; - return {out, detail::copy_str(buffer, end, out)}; + return {out, detail::copy_str_noinline(buffer, end, out)}; } template @@ -1113,7 +1119,7 @@ inline It format_uint(It out, UInt value, int num_digits, bool upper = false) { // Buffer should be large enough to hold all digits (digits / BASE_BITS + 1). char buffer[num_bits() / BASE_BITS + 1]; format_uint(buffer, value, num_digits, upper); - return detail::copy_str(buffer, buffer + num_digits, out); + return detail::copy_str_noinline(buffer, buffer + num_digits, out); } // A converter from UTF-8 to UTF-16.