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) {