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

◆ NegativeInt32ToDecStr()

static unsafe string System.Number.NegativeInt32ToDecStr ( int value,
int digits,
string sNegative )
inlinestaticprivate

Definition at line 2255 of file Number.cs.

2256 {
2257 if (digits < 1)
2258 {
2259 digits = 1;
2260 }
2261 int num = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length;
2262 string text = string.FastAllocateString(num);
2263 fixed (char* ptr = text)
2264 {
2265 char* ptr2 = UInt32ToDecChars(ptr + num, (uint)(-value), digits);
2266 for (int num2 = sNegative.Length - 1; num2 >= 0; num2--)
2267 {
2268 *(--ptr2) = sNegative[num2];
2269 }
2270 }
2271 return text;
2272 }
static unsafe byte * UInt32ToDecChars(byte *bufferEnd, uint value, int digits)
Definition Number.cs:2360

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

Referenced by System.Number.FormatInt32(), and System.Number.Int32ToDecStr().