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

◆ TryParseInt64N()

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

Definition at line 2159 of file Utf8Parser.cs.

2160 {
2161 int num;
2162 int num2;
2163 long num4;
2164 int num3;
2165 if (source.Length >= 1)
2166 {
2167 num = 1;
2168 num2 = 0;
2169 num3 = source[num2];
2170 if (num3 == 45)
2171 {
2172 num = -1;
2173 num2++;
2174 if ((uint)num2 >= (uint)source.Length)
2175 {
2176 goto IL_0115;
2177 }
2178 num3 = source[num2];
2179 }
2180 else if (num3 == 43)
2181 {
2182 num2++;
2183 if ((uint)num2 >= (uint)source.Length)
2184 {
2185 goto IL_0115;
2186 }
2187 num3 = source[num2];
2188 }
2189 if (num3 != 46)
2190 {
2191 if (ParserHelpers.IsDigit(num3))
2192 {
2193 num4 = num3 - 48;
2194 while (true)
2195 {
2196 num2++;
2197 if ((uint)num2 >= (uint)source.Length)
2198 {
2199 break;
2200 }
2201 num3 = source[num2];
2202 if (num3 == 44)
2203 {
2204 continue;
2205 }
2206 if (num3 == 46)
2207 {
2208 goto IL_00f0;
2209 }
2210 if (!ParserHelpers.IsDigit(num3))
2211 {
2212 break;
2213 }
2214 if ((ulong)num4 <= 922337203685477580uL)
2215 {
2216 num4 = num4 * 10 + num3 - 48;
2217 if ((ulong)num4 <= (ulong)(long.MaxValue + (-1 * num + 1) / 2))
2218 {
2219 continue;
2220 }
2221 }
2222 goto IL_0115;
2223 }
2224 goto IL_011e;
2225 }
2226 }
2227 else
2228 {
2229 num4 = 0L;
2230 num2++;
2231 if ((uint)num2 < (uint)source.Length && source[num2] == 48)
2232 {
2233 goto IL_00f0;
2234 }
2235 }
2236 }
2237 goto IL_0115;
2238 IL_0115:
2239 bytesConsumed = 0;
2240 value = 0L;
2241 return false;
2242 IL_010d:
2243 if (ParserHelpers.IsDigit(num3))
2244 {
2245 goto IL_0115;
2246 }
2247 goto IL_011e;
2248 IL_00f0:
2249 while (true)
2250 {
2251 num2++;
2252 if ((uint)num2 >= (uint)source.Length)
2253 {
2254 break;
2255 }
2256 num3 = source[num2];
2257 if (num3 == 48)
2258 {
2259 continue;
2260 }
2261 goto IL_010d;
2262 }
2263 goto IL_011e;
2264 IL_011e:
2265 bytesConsumed = num2;
2266 value = num4 * num;
2267 return true;
2268 }

References System.Buffers.Text.ParserHelpers.IsDigit(), System.L, System.source, and System.value.

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