diff --git a/include/fmt/format.h b/include/fmt/format.h index c794f8a4..b2bae65a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1073,11 +1073,13 @@ inline auto equal2(const char* lhs, const char* rhs) -> bool { } // Copies two characters from src to dst. -template void copy2(Char* dst, const char* src) { - *dst++ = static_cast(*src++); - *dst = static_cast(*src); +template +FMT_CONSTEXPR void copy2(Char* dst, const char* src) { + char dc0 = *src++; + char dc1 = *src; + *dst++ = static_cast(dc0); + *dst = static_cast(dc1); } -FMT_INLINE void copy2(char* dst, const char* src) { memcpy(dst, src, 2); } template struct format_decimal_result { Iterator begin;