Skip to content

Commit

Permalink
Apply minor optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jul 14, 2024
1 parent 25adca5 commit 58d792b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 58d792b

Please sign in to comment.