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

◆ Int64ToHexStr()

static unsafe string System.Number.Int64ToHexStr ( long value,
char hexBase,
int digits )
inlinestaticprivate

Definition at line 2541 of file Number.cs.

2542 {
2543 int num = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value));
2544 string text = string.FastAllocateString(num);
2545 fixed (char* ptr = text)
2546 {
2547 char* buffer = ptr + num;
2548 if (High32((ulong)value) != 0)
2549 {
2550 buffer = Int32ToHexChars(buffer, Low32((ulong)value), hexBase, 8);
2551 buffer = Int32ToHexChars(buffer, High32((ulong)value), hexBase, digits - 8);
2552 }
2553 else
2554 {
2555 buffer = Int32ToHexChars(buffer, Low32((ulong)value), hexBase, Math.Max(digits, 1));
2556 }
2557 }
2558 return text;
2559 }
static uint High32(ulong value)
Definition Number.cs:3498
static uint Low32(ulong value)
Definition Number.cs:3493
static unsafe char * Int32ToHexChars(char *buffer, uint value, int hexBase, int digits)
Definition Number.cs:2333

References System.buffer, System.Buffers.Text.FormattingHelpers.CountHexDigits(), System.Number.High32(), System.Number.Int32ToHexChars(), System.Number.Low32(), System.Math.Max(), System.text, and System.value.

Referenced by System.Number.FormatInt64(), and System.Number.FormatUInt64().