8302871: Speed up StringLatin1.regionMatchesCI

Reviewed-by: redestad, martin, alanb
This commit is contained in:
Eirik Bjorsnos 2023-02-25 07:48:03 +00:00 committed by Alan Bateman
parent b4ea80731c
commit 17e3769ed7
4 changed files with 161 additions and 18 deletions

View file

@ -384,14 +384,9 @@ final class StringLatin1 {
byte[] other, int ooffset, int len) {
int last = toffset + len;
while (toffset < last) {
char c1 = (char)(value[toffset++] & 0xff);
char c2 = (char)(other[ooffset++] & 0xff);
if (c1 == c2) {
continue;
}
int u1 = CharacterDataLatin1.instance.toUpperCase(c1);
int u2 = CharacterDataLatin1.instance.toUpperCase(c2);
if (u1 == u2) {
byte b1 = value[toffset++];
byte b2 = other[ooffset++];
if (CharacterDataLatin1.equalsIgnoreCase(b1, b2)) {
continue;
}
return false;