mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Fix ToString() for int32.MinValue and int64.MinValue
This commit is contained in:
parent
323f984a72
commit
bec7dff380
2 changed files with 15 additions and 15 deletions
|
@ -54,15 +54,15 @@ namespace System
|
|||
char8[] strChars = scope:: char8[16];
|
||||
int32 char8Idx = 14;
|
||||
int32 valLeft = (int32)this;
|
||||
bool isNeg = false;
|
||||
if (valLeft < 0)
|
||||
bool isNeg = true;
|
||||
if (valLeft >= 0)
|
||||
{
|
||||
valLeft = -valLeft;
|
||||
isNeg = true;
|
||||
isNeg = false;
|
||||
}
|
||||
while (valLeft > 0)
|
||||
while (valLeft < 0)
|
||||
{
|
||||
strChars[char8Idx] = (char8)('0' + (valLeft % 10));
|
||||
strChars[char8Idx] = (char8)('0' - (valLeft % 10));
|
||||
valLeft /= 10;
|
||||
char8Idx--;
|
||||
}
|
||||
|
@ -80,16 +80,16 @@ namespace System
|
|||
char8[] strChars = scope:: char8[16];
|
||||
int32 char8Idx = 14;
|
||||
int32 valLeft = (int32)this;
|
||||
bool isNeg = false;
|
||||
bool isNeg = true;
|
||||
int minNumeralsLeft = minNumerals;
|
||||
if (valLeft < 0)
|
||||
if (valLeft >= 0)
|
||||
{
|
||||
valLeft = -valLeft;
|
||||
isNeg = true;
|
||||
isNeg = false;
|
||||
}
|
||||
while ((valLeft > 0) || (minNumeralsLeft > 0))
|
||||
while ((valLeft < 0) || (minNumeralsLeft > 0))
|
||||
{
|
||||
strChars[char8Idx] = (char8)('0' + (valLeft % 10));
|
||||
strChars[char8Idx] = (char8)('0' - (valLeft % 10));
|
||||
valLeft /= 10;
|
||||
char8Idx--;
|
||||
minNumeralsLeft--;
|
||||
|
|
|
@ -71,16 +71,16 @@ namespace System
|
|||
char8[] strChars = scope:: char8[22];
|
||||
int32 char8Idx = 20;
|
||||
int64 valLeft = (int64)this;
|
||||
bool isNeg = false;
|
||||
bool isNeg = true;
|
||||
int minNumeralsLeft = 0;
|
||||
if (valLeft < 0)
|
||||
if (valLeft >= 0)
|
||||
{
|
||||
valLeft = -valLeft;
|
||||
isNeg = true;
|
||||
isNeg = false;
|
||||
}
|
||||
while ((valLeft > 0) || (minNumeralsLeft > 0))
|
||||
while ((valLeft < 0) || (minNumeralsLeft > 0))
|
||||
{
|
||||
strChars[char8Idx] = (char8)('0' + (valLeft % 10));
|
||||
strChars[char8Idx] = (char8)('0' - (valLeft % 10));
|
||||
valLeft /= 10;
|
||||
char8Idx--;
|
||||
minNumeralsLeft--;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue