From 9d04f3bd506610181d8c7f222d673b8b71811ad4 Mon Sep 17 00:00:00 2001 From: bobqianic <129547291+bobqianic@users.noreply.github.com> Date: Wed, 14 Feb 2024 00:49:19 +0000 Subject: [PATCH] Update unicode.h --- unicode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unicode.h b/unicode.h index 95d807926..f25210c42 100644 --- a/unicode.h +++ b/unicode.h @@ -658,8 +658,8 @@ static bool codepoint_type_init() { } static int codepoint_type(uint32_t cp) { - static std::unordered_map codepoint_types = codepoint_type_map(); - return codepoint_types.find(cp) == codepoint_types.end() ? CODEPOINT_TYPE_UNIDENTIFIED : codepoint_types.at(cp); + static bool codepoint_type_initialized = codepoint_type_init(); + return codepoint_type_binary_search(cp); } static int codepoint_type(const std::string & utf8) {