10 for (
int i = 0; i < span.
Length; i++)
16 num = num * 10 + c - 48;
25 internal unsafe
static bool IsValid(
char* name,
int start, ref
int end,
bool allowIPv6,
bool notImplicitFile,
bool unknownScheme)
27 if (allowIPv6 || unknownScheme)
34 internal unsafe
static bool IsValidCanonical(
char* name,
int start, ref
int end,
bool allowIPv6,
bool notImplicitFile)
45 if (c ==
']' || c ==
'/' || c ==
'%')
50 else if (c ==
'/' || c ==
'\\' || (notImplicitFile && (c ==
':' || c ==
'?' || c ==
'#')))
54 if (c <=
'9' && c >=
'0')
56 if (!flag && c ==
'0')
65 num2 = num2 * 10 + (name[
start] - 48);
77 if (!flag || (num2 > 0 && flag2))
88 bool flag3 = num == 3 && flag;
99 long* ptr = stackalloc
long[4];
104 for (i =
start; i < end; i++)
117 if (c ==
'x' || c ==
'X')
129 if ((num == 10 || num == 16) &&
'0' <= c && c <=
'9')
133 else if (num == 8 &&
'0' <= c && c <=
'7')
137 else if (num == 16 &&
'a' <= c && c <=
'f')
143 if (num != 16 ||
'A' > c || c >
'F')
149 num2 = num2 * num + num4;
150 if (num2 > uint.MaxValue)
156 if (i >= end || name[i] !=
'.')
160 if (num3 >= 3 || !flag || num2 > 255)
175 if ((c = name[i]) !=
'/' && c !=
'\\' && (!notImplicitFile || (c !=
':' && c !=
'?' && c !=
'#')))
185 if (*ptr > uint.MaxValue)
191 if (ptr[1] > 16777215)
195 return (*ptr << 24) | (ptr[1] & 0xFFFFFF);
201 return (*ptr << 24) | ((ptr[1] & 0xFF) << 16) | (ptr[2] & 0xFFFF);
207 return (*ptr << 24) | ((ptr[1] & 0xFF) << 16) | ((ptr[2] & 0xFF) << 8) | (ptr[3] & 0xFF);
static int ReadInt32BigEndian(ReadOnlySpan< byte > source)
static unsafe bool IsValid(char *name, int start, ref int end, bool allowIPv6, bool notImplicitFile, bool unknownScheme)
static unsafe bool IsValidCanonical(char *name, int start, ref int end, bool allowIPv6, bool notImplicitFile)
static int ParseHostNumber(ReadOnlySpan< char > str, int start, int end)
static unsafe long ParseNonCanonical(char *name, int start, ref int end, bool notImplicitFile)