dont construct new locale every time
This commit is contained in:
parent
4bffc07144
commit
4a24bdfabd
1 changed files with 2 additions and 1 deletions
|
@ -9001,12 +9001,13 @@ struct llm_tokenizer_wpm {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t to_lower(uint32_t code) {
|
uint32_t to_lower(uint32_t code) {
|
||||||
|
static const std::locale locale("en_US.UTF-8");
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
if (code > 0xFFFF) {
|
if (code > 0xFFFF) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return std::tolower(wchar_t(code), std::locale("en_US.UTF-8"));
|
return std::tolower(wchar_t(code), locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_ascii_punct(uint32_t code) {
|
bool is_ascii_punct(uint32_t code) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue