From 00ac8aad7ff3d0a82419b31cdeaa593d228c07d1 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 18 Dec 2021 10:16:40 +0100 Subject: Speed optimization --- include/unicode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/unicode.h b/include/unicode.h index 37342a1..277c4de 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -30,7 +30,7 @@ namespace unicode { template static inline bool is_valid_unicode(const T& value) { - return value <= 0x10FFFF && (value <= 0xD7FF || value >= 0xE000); + return value <= 0xD7FF || (value >= 0xE000 && value <= 0x10FFFF); } } @@ -475,7 +475,7 @@ namespace unicode { if (value > 255) throw std::invalid_argument("Bad Unicode value above 255: "s + std::to_string(static_cast(value))); - s.push_back(static_cast(value)); + s.push_back(static_cast(value)); return *this; } -- cgit v1.2.3