Cosmos/source/Indy.IL2CPU.IL/CustomImplementations/System/UInt64Impl.cs
mterwoord_cp db03691ff6
2008-02-08 08:15:59 +00:00

31 lines
855 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Indy.IL2CPU.Plugs;
namespace Indy.IL2CPU.IL.CustomImplementations.System {
[Plug(Target = typeof(UInt64))]
public class UInt64Impl {
public static string ToString(ref ulong aThis) {
return GetNumberString(aThis, false);
}
public static string GetNumberString(ulong aValue, bool aIsNegative) {
const string xDigits = "0123456789";
char[] xResultChars = new char[21];
int xCurrentPos = 20;
while (aValue > 0) {
byte xPos = (byte)(aValue % 10);
aValue /= 10;
xResultChars[xCurrentPos] = xDigits[xPos];
xCurrentPos -= 1;
}
if (aIsNegative) {
xResultChars[xCurrentPos] = '-';
xCurrentPos -= 1;
}
return new String(xResultChars, xCurrentPos + 1, 20 - xCurrentPos);
}
}
}