14 {
16 int num = ((-1 == radix) ? 10 : radix);
17 if (num != 2 && num != 10 && num != 8 && num != 16)
18 {
20 }
23 {
24 throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_Index);
25 }
26 if ((flags & 0x1000) == 0 && (flags & 0x2000) == 0)
27 {
30 {
31 throw new FormatException(SR.Format_EmptyInputString);
32 }
33 }
34 int num2 = 1;
36 {
37 if (num != 10)
38 {
40 }
41 if (((uint)flags & 0x200u) != 0)
42 {
43 throw new OverflowException(SR.Overflow_NegativeUnsigned);
44 }
45 num2 = -1;
47 }
49 {
51 }
52 if ((radix == -1 || radix == 16) && i + 1 <
length &&
s[i] ==
'0' && (
s[i + 1] ==
'x' ||
s[i + 1] ==
'X'))
53 {
54 num = 16;
56 }
58 long num4 =
GrabLongs(num,
s, ref i, (flags & 0x200) != 0);
59 if (i == num3)
60 {
61 throw new FormatException(SR.Format_NoParsibleDigits);
62 }
63 if (((uint)flags & 0x1000u) != 0 && i <
length)
64 {
65 throw new FormatException(SR.Format_ExtraJunkAtEnd);
66 }
68 if (num4 == long.MinValue && num2 == 1 && num == 10 && (flags & 0x200) == 0)
69 {
70 Number.ThrowOverflowException(TypeCode.Int64);
71 }
72 if (num == 10)
73 {
74 num4 *= num2;
75 }
76 return num4;
77 }
static long GrabLongs(int radix, ReadOnlySpan< char > s, ref int i, bool isUnsigned)
static void EatWhiteSpace(ReadOnlySpan< char > s, ref int i)