mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8268698: Use Objects.check{Index,FromToIndex,FromIndexSize} for java.base
Reviewed-by: mchung, rriggs
This commit is contained in:
parent
a4e5f08fef
commit
afe957cd97
40 changed files with 186 additions and 284 deletions
|
@ -39,14 +39,13 @@ import jdk.internal.vm.annotation.IntrinsicCandidate;
|
|||
|
||||
import static java.lang.String.LATIN1;
|
||||
import static java.lang.String.UTF16;
|
||||
import static java.lang.String.checkIndex;
|
||||
import static java.lang.String.checkOffset;
|
||||
|
||||
final class StringLatin1 {
|
||||
|
||||
public static char charAt(byte[] value, int index) {
|
||||
if (index < 0 || index >= value.length) {
|
||||
throw new StringIndexOutOfBoundsException(index);
|
||||
}
|
||||
checkIndex(index, value.length);
|
||||
return (char)(value[index] & 0xff);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue