mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8325169: Reduce String::indexOf overheads
Reviewed-by: rriggs, rgiulietti, mli
This commit is contained in:
parent
89e6a02e3b
commit
19e92201b4
4 changed files with 23 additions and 19 deletions
|
@ -310,15 +310,11 @@ final class StringLatin1 {
|
|||
};
|
||||
}
|
||||
|
||||
// Caller must ensure that from- and toIndex are within bounds
|
||||
public static int indexOf(byte[] value, int ch, int fromIndex, int toIndex) {
|
||||
if (!canEncode(ch)) {
|
||||
return -1;
|
||||
}
|
||||
fromIndex = Math.max(fromIndex, 0);
|
||||
toIndex = Math.min(toIndex, value.length);
|
||||
if (fromIndex >= toIndex) {
|
||||
return -1;
|
||||
}
|
||||
return indexOfChar(value, ch, fromIndex, toIndex);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue