Update unicode.h

This commit is contained in:
bobqianic 2024-02-14 00:49:19 +00:00 committed by GitHub
parent 3cd3964587
commit 9d04f3bd50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -658,8 +658,8 @@ static bool codepoint_type_init() {
} }
static int codepoint_type(uint32_t cp) { static int codepoint_type(uint32_t cp) {
static std::unordered_map<uint32_t, int> codepoint_types = codepoint_type_map(); static bool codepoint_type_initialized = codepoint_type_init();
return codepoint_types.find(cp) == codepoint_types.end() ? CODEPOINT_TYPE_UNIDENTIFIED : codepoint_types.at(cp); return codepoint_type_binary_search(cp);
} }
static int codepoint_type(const std::string & utf8) { static int codepoint_type(const std::string & utf8) {