Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UInt64ToDecStr()

static unsafe string System.Number.UInt64ToDecStr ( ulong value,
int digits )
inlinestaticpackage

Definition at line 2606 of file Number.cs.

2607 {
2608 if (digits < 1)
2609 {
2610 digits = 1;
2611 }
2612 int num = Math.Max(digits, FormattingHelpers.CountDigits(value));
2613 if (num == 1)
2614 {
2616 }
2617 string text = string.FastAllocateString(num);
2618 fixed (char* ptr = text)
2619 {
2620 char* bufferEnd = ptr + num;
2621 while (High32(value) != 0)
2622 {
2623 bufferEnd = UInt32ToDecChars(bufferEnd, Int64DivMod1E9(ref value), 9);
2624 digits -= 9;
2625 }
2626 bufferEnd = UInt32ToDecChars(bufferEnd, Low32(value), digits);
2627 }
2628 return text;
2629 }
static uint High32(ulong value)
Definition Number.cs:3498
static uint Int64DivMod1E9(ref ulong value)
Definition Number.cs:3503
static uint Low32(ulong value)
Definition Number.cs:3493
static readonly string[] s_singleDigitStringCache
Definition Number.cs:1233
static unsafe byte * UInt32ToDecChars(byte *bufferEnd, uint value, int digits)
Definition Number.cs:2360

References System.Buffers.Text.FormattingHelpers.CountDigits(), System.Number.High32(), System.Number.Int64DivMod1E9(), System.Number.Low32(), System.Math.Max(), System.Number.s_singleDigitStringCache, System.text, System.Number.UInt32ToDecChars(), and System.value.

Referenced by System.Number.FormatInt64(), System.Number.FormatUInt64(), System.Number.Int64ToDecStr(), System.UInt64.ToString(), and System.UInt64.ToString().