mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8337167: StringSize deduplication
Reviewed-by: liach, rriggs
This commit is contained in:
parent
487450cb5e
commit
7f11935461
8 changed files with 40 additions and 95 deletions
|
@ -27,6 +27,7 @@ package java.lang;
|
|||
|
||||
import jdk.internal.math.DoubleToDecimal;
|
||||
import jdk.internal.math.FloatToDecimal;
|
||||
import jdk.internal.util.DecimalDigits;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.CharBuffer;
|
||||
|
@ -836,7 +837,7 @@ abstract sealed class AbstractStringBuilder implements Appendable, CharSequence
|
|||
*/
|
||||
public AbstractStringBuilder append(int i) {
|
||||
int count = this.count;
|
||||
int spaceNeeded = count + Integer.stringSize(i);
|
||||
int spaceNeeded = count + DecimalDigits.stringSize(i);
|
||||
ensureCapacityInternal(spaceNeeded);
|
||||
if (isLatin1()) {
|
||||
StringLatin1.getChars(i, spaceNeeded, value);
|
||||
|
@ -861,7 +862,7 @@ abstract sealed class AbstractStringBuilder implements Appendable, CharSequence
|
|||
*/
|
||||
public AbstractStringBuilder append(long l) {
|
||||
int count = this.count;
|
||||
int spaceNeeded = count + Long.stringSize(l);
|
||||
int spaceNeeded = count + DecimalDigits.stringSize(l);
|
||||
ensureCapacityInternal(spaceNeeded);
|
||||
if (isLatin1()) {
|
||||
StringLatin1.getChars(l, spaceNeeded, value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue