Skip to content

Commit 6172b22

Browse files
ggerganovhodlen
authored andcommitted
unicode : reuse iterator (ggml-org#5726)
1 parent ed56ecf commit 6172b22

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

unicode.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ static std::unordered_map<uint32_t, int> codepoint_type_map() {
404404

405405
static int codepoint_type(uint32_t cp) {
406406
static std::unordered_map<uint32_t, int> codepoint_types = codepoint_type_map();
407-
return codepoint_types.find(cp) == codepoint_types.end() ? CODEPOINT_TYPE_UNIDENTIFIED : codepoint_types.at(cp);
407+
const auto it = codepoint_types.find(cp);
408+
return it == codepoint_types.end() ? CODEPOINT_TYPE_UNIDENTIFIED : it->second;
408409
}
409410

410411
static int codepoint_type(const std::string & utf8) {

0 commit comments

Comments
 (0)