8278831: Use table lookup for the last two bytes in Integer.getChars

Reviewed-by: jlaskey, rriggs
This commit is contained in:
Claes Redestad 2022-01-17 11:01:55 +00:00
parent 431bd9a66d
commit 71ca85f5a6
4 changed files with 26 additions and 31 deletions

View file

@ -565,13 +565,9 @@ public final class Long extends Number
}
// We know there are at most two digits left at this point.
q2 = i2 / 10;
r = (q2 * 10) - i2;
buf[--charPos] = (byte)('0' + r);
// Whatever left is the remaining digit.
if (q2 < 0) {
buf[--charPos] = (byte)('0' - q2);
buf[--charPos] = Integer.DigitOnes[-i2];
if (i2 < -9) {
buf[--charPos] = Integer.DigitTens[-i2];
}
if (negative) {