mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-29 21:05:59 +02:00
Fix ToString formatting for uint32 (cascading to uint16, uint8 and uint)
This commit is contained in:
parent
114f5a3c92
commit
73ec76540e
1 changed files with 25 additions and 41 deletions
|
@ -57,13 +57,7 @@ namespace System
|
|||
// Dumb, make better.
|
||||
char8[] strChars = scope:: char8[16];
|
||||
int32 char8Idx = 14;
|
||||
int32 valLeft = (int32)this;
|
||||
bool isNeg = false;
|
||||
if (valLeft < 0)
|
||||
{
|
||||
valLeft = -valLeft;
|
||||
isNeg = true;
|
||||
}
|
||||
uint32 valLeft = (uint32)this;
|
||||
while (valLeft > 0)
|
||||
{
|
||||
strChars[char8Idx] = (char8)('0' + (valLeft % 10));
|
||||
|
@ -72,8 +66,6 @@ namespace System
|
|||
}
|
||||
if (char8Idx == 14)
|
||||
strChars[char8Idx--] = '0';
|
||||
if (isNeg)
|
||||
strChars[char8Idx--] = '-';
|
||||
char8* char8Ptr = &strChars[char8Idx + 1];
|
||||
strBuffer.Append(char8Ptr);
|
||||
}
|
||||
|
@ -83,14 +75,8 @@ namespace System
|
|||
// Dumb, make better.
|
||||
char8[] strChars = scope:: char8[16];
|
||||
int32 char8Idx = 14;
|
||||
int32 valLeft = (int32)this;
|
||||
bool isNeg = false;
|
||||
uint32 valLeft = (uint32)this;
|
||||
int minNumeralsLeft = minNumerals;
|
||||
if (valLeft < 0)
|
||||
{
|
||||
valLeft = -valLeft;
|
||||
isNeg = true;
|
||||
}
|
||||
while ((valLeft > 0) || (minNumeralsLeft > 0))
|
||||
{
|
||||
strChars[char8Idx] = (char8)('0' + (valLeft % 10));
|
||||
|
@ -100,8 +86,6 @@ namespace System
|
|||
}
|
||||
if (char8Idx == 14)
|
||||
strChars[char8Idx--] = '0';
|
||||
if (isNeg)
|
||||
strChars[char8Idx--] = '-';
|
||||
char8* char8Ptr = &strChars[char8Idx + 1];
|
||||
strBuffer.Append(char8Ptr);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue