mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-13 20:05:31 +00:00
8357685: Change the type of Integer::digits from char[] to byte[]
Reviewed-by: rgiulietti, liach
This commit is contained in:
parent
b034710b2a
commit
4a4209ffef
@ -100,7 +100,8 @@ public final class Integer extends Number
|
||||
/**
|
||||
* All possible chars for representing a number as a String
|
||||
*/
|
||||
static final char[] digits = {
|
||||
@Stable
|
||||
static final byte[] digits = {
|
||||
'0' , '1' , '2' , '3' , '4' , '5' ,
|
||||
'6' , '7' , '8' , '9' , 'a' , 'b' ,
|
||||
'c' , 'd' , 'e' , 'f' , 'g' , 'h' ,
|
||||
@ -172,10 +173,10 @@ public final class Integer extends Number
|
||||
}
|
||||
|
||||
while (i <= -radix) {
|
||||
buf[charPos--] = (byte)digits[-(i % radix)];
|
||||
buf[charPos--] = digits[-(i % radix)];
|
||||
i = i / radix;
|
||||
}
|
||||
buf[charPos] = (byte)digits[-i];
|
||||
buf[charPos] = digits[-i];
|
||||
|
||||
if (negative) {
|
||||
buf[--charPos] = '-';
|
||||
@ -392,7 +393,7 @@ public final class Integer extends Number
|
||||
int radix = 1 << shift;
|
||||
int mask = radix - 1;
|
||||
do {
|
||||
buf[--charPos] = (byte)Integer.digits[val & mask];
|
||||
buf[--charPos] = Integer.digits[val & mask];
|
||||
val >>>= shift;
|
||||
} while (charPos > 0);
|
||||
}
|
||||
|
||||
@ -157,10 +157,10 @@ public final class Long extends Number
|
||||
}
|
||||
|
||||
while (i <= -radix) {
|
||||
buf[charPos--] = (byte)Integer.digits[(int)(-(i % radix))];
|
||||
buf[charPos--] = Integer.digits[(int)(-(i % radix))];
|
||||
i = i / radix;
|
||||
}
|
||||
buf[charPos] = (byte)Integer.digits[(int)(-i)];
|
||||
buf[charPos] = Integer.digits[(int)(-i)];
|
||||
|
||||
if (negative) {
|
||||
buf[--charPos] = '-';
|
||||
@ -422,7 +422,7 @@ public final class Long extends Number
|
||||
int radix = 1 << shift;
|
||||
int mask = radix - 1;
|
||||
do {
|
||||
buf[--charPos] = (byte)Integer.digits[((int) val) & mask];
|
||||
buf[--charPos] = Integer.digits[((int) val) & mask];
|
||||
val >>>= shift;
|
||||
} while (charPos > offset);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user