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

◆ TryInt32ToHexStr()

static unsafe bool System.Number.TryInt32ToHexStr ( int value,
char hexBase,
int digits,
Span< char > destination,
out int charsWritten )
inlinestaticprivate

Definition at line 2313 of file Number.cs.

2314 {
2315 if (digits < 1)
2316 {
2317 digits = 1;
2318 }
2319 int num = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value));
2320 if (num > destination.Length)
2321 {
2322 charsWritten = 0;
2323 return false;
2324 }
2325 charsWritten = num;
2326 fixed (char* ptr = &MemoryMarshal.GetReference(destination))
2327 {
2328 char* ptr2 = Int32ToHexChars(ptr + num, (uint)value, hexBase, digits);
2329 }
2330 return true;
2331 }
static unsafe char * Int32ToHexChars(char *buffer, uint value, int hexBase, int digits)
Definition Number.cs:2333

References System.Buffers.Text.FormattingHelpers.CountHexDigits(), System.destination, System.Number.Int32ToHexChars(), System.Math.Max(), and System.value.

Referenced by System.Number.TryFormatInt32(), and System.Number.TryFormatUInt32().