Apply minor optimizations

This commit is contained in:
Victor Zverovich 2024-07-14 07:05:18 -07:00
parent 25adca5666
commit 58d792b6d3
2 changed files with 2 additions and 1 deletions

View File

@ -467,6 +467,7 @@ template <typename Char> FMT_CONSTEXPR auto length(const Char* s) -> size_t {
template <typename Char>
FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n)
-> int {
if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n);
for (; n != 0; ++s1, ++s2, --n) {
if (*s1 < *s2) return -1;
if (*s1 > *s2) return 1;

View File

@ -553,7 +553,7 @@ struct scan_handler {
return begin;
}
void on_error(const char* message) { report_error(message); }
FMT_NORETURN void on_error(const char* message) { report_error(message); }
};
void vscan(detail::scan_buffer& buf, string_view fmt, scan_args args) {