Create subslice as that leads to a smaller code size.
This commit is contained in:
parent
2d9f0e2c50
commit
a5b25a2cfa
1 changed files with 4 additions and 3 deletions
|
@ -153,14 +153,15 @@ impl<'a> StringReader<'a> {
|
||||||
match core::slice::memchr::memchr(0xE2, &bytes) {
|
match core::slice::memchr::memchr(0xE2, &bytes) {
|
||||||
Some(idx) => {
|
Some(idx) => {
|
||||||
// bytes are valid UTF-8 -> E2 must be followed by two bytes
|
// bytes are valid UTF-8 -> E2 must be followed by two bytes
|
||||||
match bytes[idx + 1] {
|
let ch = &bytes[idx..idx + 3];
|
||||||
|
match ch[1] {
|
||||||
0x80 => {
|
0x80 => {
|
||||||
if (0xAA..=0xAE).contains(&bytes[idx + 2]) {
|
if (0xAA..=0xAE).contains(&ch[2]) {
|
||||||
break true;
|
break true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0x81 => {
|
0x81 => {
|
||||||
if (0xA6..=0xA9).contains(&bytes[idx + 2]) {
|
if (0xA6..=0xA9).contains(&ch[2]) {
|
||||||
break true;
|
break true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue