mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
Drop impossible case in negative int.toString
This fast path is never taken, because it's subsumed by the even-faster path at the top of toString. When this function is called, negSmi is always <= -100. Tested: ci Change-Id: I687fada0222b7815c41151b84c1ce4b1d312d6e8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284260 Reviewed-by: Aske Simon Christensen <askesc@google.com> Commit-Queue: Ömer Ağacan <omersa@google.com>
This commit is contained in:
parent
a3038980d5
commit
8e600908b6
|
@ -733,18 +733,6 @@ class _Smi extends _IntegerImplementation {
|
|||
const int MINUS_SIGN = 0x2d;
|
||||
// Character code for '0'.
|
||||
const int DIGIT_ZERO = 0x30;
|
||||
if (negSmi > -10) {
|
||||
return _OneByteString._allocate(2)
|
||||
.._setAt(0, MINUS_SIGN)
|
||||
.._setAt(1, DIGIT_ZERO - negSmi);
|
||||
}
|
||||
if (negSmi > -100) {
|
||||
int digitIndex = 2 * -negSmi;
|
||||
return _OneByteString._allocate(3)
|
||||
.._setAt(0, MINUS_SIGN)
|
||||
.._setAt(1, _digitTable[digitIndex])
|
||||
.._setAt(2, _digitTable[digitIndex + 1]);
|
||||
}
|
||||
// Number of digits, not including minus.
|
||||
int digitCount = _negativeBase10Length(negSmi);
|
||||
_OneByteString result = _OneByteString._allocate(digitCount + 1);
|
||||
|
|
|
@ -688,18 +688,6 @@ class _BoxedInt extends int {
|
|||
const int MINUS_SIGN = 0x2d;
|
||||
// Character code for '0'.
|
||||
const int DIGIT_ZERO = 0x30;
|
||||
if (negSmi > -10) {
|
||||
return _OneByteString._allocate(2)
|
||||
.._setAt(0, MINUS_SIGN)
|
||||
.._setAt(1, DIGIT_ZERO - negSmi);
|
||||
}
|
||||
if (negSmi > -100) {
|
||||
int digitIndex = 2 * -negSmi;
|
||||
return _OneByteString._allocate(3)
|
||||
.._setAt(0, MINUS_SIGN)
|
||||
.._setAt(1, _digitTable[digitIndex])
|
||||
.._setAt(2, _digitTable[digitIndex + 1]);
|
||||
}
|
||||
// Number of digits, not including minus.
|
||||
int digitCount = _negativeBase10Length(negSmi);
|
||||
_OneByteString result = _OneByteString._allocate(digitCount + 1);
|
||||
|
|
Loading…
Reference in a new issue