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

◆ TryParseUInt64D()

static bool System.Buffers.Text.Utf8Parser.TryParseUInt64D ( ReadOnlySpan< byte > source,
out ulong value,
out int bytesConsumed )
inlinestaticprivate

Definition at line 2670 of file Utf8Parser.cs.

2671 {
2672 if (!source.IsEmpty)
2673 {
2674 nuint num = (uint)(source[0] - 48);
2675 if ((uint)num <= 9)
2676 {
2677 ulong num2 = num;
2678 int i = 1;
2679 if (source.Length < 20)
2680 {
2681 for (; (uint)i < (uint)source.Length; i++)
2682 {
2683 nuint num3 = (uint)(source[i] - 48);
2684 if ((uint)num3 > 9)
2685 {
2686 break;
2687 }
2688 num2 = num2 * 10 + num3;
2689 }
2690 }
2691 else
2692 {
2693 while ((uint)i < (uint)source.Length)
2694 {
2695 nuint num4 = (uint)(source[i] - 48);
2696 if ((uint)num4 > 9)
2697 {
2698 break;
2699 }
2700 i++;
2701 if (num2 < 1844674407370955161L)
2702 {
2703 num2 = num2 * 10 + num4;
2704 continue;
2705 }
2706 if (num2 == 1844674407370955161L && (uint)num4 <= 5)
2707 {
2708 num2 = 18446744073709551610uL + (ulong)num4;
2709 continue;
2710 }
2711 goto IL_00c0;
2712 }
2713 }
2714 bytesConsumed = i;
2715 value = num2;
2716 return true;
2717 }
2718 }
2719 goto IL_00c0;
2720 IL_00c0:
2721 bytesConsumed = 0;
2722 value = 0uL;
2723 return false;
2724 }

References System.L, System.source, and System.value.

Referenced by System.Buffers.Text.Utf8Parser.TryParse().