4993841: (str) java.lang.Character should have a toString(int) method

Reviewed-by: martin, rriggs, sherman, smarks
This commit is contained in:
Naoto Sato 2018-03-05 08:50:47 -08:00
parent a131e1668f
commit 3d4edcc571
4 changed files with 91 additions and 3 deletions

View file

@ -235,6 +235,13 @@ final class StringUTF16 {
return result;
}
static byte[] toBytesSupplementary(int cp) {
byte[] result = new byte[4];
putChar(result, 0, Character.highSurrogate(cp));
putChar(result, 1, Character.lowSurrogate(cp));
return result;
}
@HotSpotIntrinsicCandidate
public static void getChars(byte[] value, int srcBegin, int srcEnd, char dst[], int dstBegin) {
// We need a range check here because 'getChar' has no checks