perf: keep ASCII LUT parsing fast alongside Unicode decoding
这个提交包含在:
1 父节点
8951725be2
当前提交
59b058a3c8
2 个文件已更改
+27
-6
没有与搜索条件相匹配的文件
@@ -140,9 +140,9 @@ static BOOL DYLUTText(NSData *bytes,std::string& text,NSProgress *progress,NSErr
|
||||
static std::string_view DYLUTTrim(std::string_view v) {
|
||||
while(!v.empty()) {
|
||||
unsigned char c=v.front();size_t count=0;
|
||||
if(c==' '||(c>=9&&c<=13))count=1;
|
||||
else if(v.size()>=2&&v.substr(0,2)=="\xc2\xa0")count=2;
|
||||
else if(v.size()>=3&&(v.substr(0,3)=="\xe1\x9a\x80"||v.substr(0,3)=="\xe2\x80\xaf"||v.substr(0,3)=="\xe2\x81\x9f"||v.substr(0,3)=="\xe3\x80\x80"||(v.substr(0,2)=="\xe2\x80"&&(unsigned char)v[2]>=0x80&&(unsigned char)v[2]<=0x8a)))count=3;
|
||||
if(c<0x80){if(c==' '||(c>=9&&c<=13))count=1;else break;}
|
||||
else if(c==0xc2&&v.size()>=2&&v[1]=='\xa0')count=2;
|
||||
else if((c==0xe1||c==0xe2||c==0xe3)&&v.size()>=3&&(v.substr(0,3)=="\xe1\x9a\x80"||v.substr(0,3)=="\xe2\x80\xaf"||v.substr(0,3)=="\xe2\x81\x9f"||v.substr(0,3)=="\xe3\x80\x80"||(v.substr(0,2)=="\xe2\x80"&&(unsigned char)v[2]>=0x80&&(unsigned char)v[2]<=0x8a)))count=3;
|
||||
if(!count)break;v.remove_prefix(count);
|
||||
}return v;
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户