mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8268813: Better String matching
Reviewed-by: mschoene, rhalade, smarks
This commit is contained in:
parent
4be02d3155
commit
aa28430bdd
1 changed files with 2 additions and 2 deletions
|
@ -3438,8 +3438,8 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||
private static final int countChars(CharSequence seq, int index,
|
||||
int lengthInCodePoints) {
|
||||
// optimization
|
||||
if (lengthInCodePoints == 1 && !Character.isHighSurrogate(seq.charAt(index))) {
|
||||
assert (index >= 0 && index < seq.length());
|
||||
if (lengthInCodePoints == 1 && index >= 0 && index < seq.length() &&
|
||||
!Character.isHighSurrogate(seq.charAt(index))) {
|
||||
return 1;
|
||||
}
|
||||
int length = seq.length();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue