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

◆ TryFormatUInt64N()

static bool System.Buffers.Text.Utf8Formatter.TryFormatUInt64N ( ulong value,
byte precision,
Span< byte > destination,
bool insertNegationSign,
out int bytesWritten )
inlinestaticprivate

Definition at line 1018 of file Utf8Formatter.cs.

1019 {
1020 int num = FormattingHelpers.CountDigits(value);
1021 int num2 = (num - 1) / 3;
1022 int num3 = ((precision == byte.MaxValue) ? 2 : precision);
1023 int num4 = num + num2;
1024 if (num3 > 0)
1025 {
1026 num4 += num3 + 1;
1027 }
1028 if (insertNegationSign)
1029 {
1030 num4++;
1031 }
1032 if (num4 > destination.Length)
1033 {
1034 bytesWritten = 0;
1035 return false;
1036 }
1037 bytesWritten = num4;
1038 if (insertNegationSign)
1039 {
1040 destination[0] = 45;
1041 destination = destination.Slice(1);
1042 }
1043 FormattingHelpers.WriteDigitsWithGroupSeparator(value, destination.Slice(0, num + num2));
1044 if (num3 > 0)
1045 {
1046 destination[num + num2] = 46;
1047 FormattingHelpers.FillWithAsciiZeros(destination.Slice(num + num2 + 1, num3));
1048 }
1049 return true;
1050 }

References System.Buffers.Text.FormattingHelpers.CountDigits(), System.destination, System.Buffers.Text.FormattingHelpers.FillWithAsciiZeros(), System.value, and System.Buffers.Text.FormattingHelpers.WriteDigitsWithGroupSeparator().

Referenced by System.Buffers.Text.Utf8Formatter.TryFormatInt64N(), and System.Buffers.Text.Utf8Formatter.TryFormatUInt64().