Apply minor optimizations

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

No files matched your search

+1
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;