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

◆ TryParseByteD()

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

Definition at line 2357 of file Utf8Parser.cs.

2358 {
2359 int num;
2360 int num3;
2361 int num2;
2362 if (source.Length >= 1)
2363 {
2364 num = 0;
2365 num2 = source[num];
2366 num3 = 0;
2367 if (ParserHelpers.IsDigit(num2))
2368 {
2369 if (num2 != 48)
2370 {
2371 goto IL_0056;
2372 }
2373 while (true)
2374 {
2375 num++;
2376 if ((uint)num >= (uint)source.Length)
2377 {
2378 break;
2379 }
2380 num2 = source[num];
2381 if (num2 == 48)
2382 {
2383 continue;
2384 }
2385 goto IL_004b;
2386 }
2387 goto IL_00dd;
2388 }
2389 }
2390 goto IL_00d5;
2391 IL_004b:
2392 if (ParserHelpers.IsDigit(num2))
2393 {
2394 goto IL_0056;
2395 }
2396 goto IL_00dd;
2397 IL_0056:
2398 num3 = num2 - 48;
2399 num++;
2400 if ((uint)num < (uint)source.Length)
2401 {
2402 num2 = source[num];
2403 if (ParserHelpers.IsDigit(num2))
2404 {
2405 num++;
2406 num3 = 10 * num3 + num2 - 48;
2407 if ((uint)num < (uint)source.Length)
2408 {
2409 num2 = source[num];
2410 if (ParserHelpers.IsDigit(num2))
2411 {
2412 num++;
2413 num3 = num3 * 10 + num2 - 48;
2414 if ((uint)num3 > 255u || ((uint)num < (uint)source.Length && ParserHelpers.IsDigit(source[num])))
2415 {
2416 goto IL_00d5;
2417 }
2418 }
2419 }
2420 }
2421 }
2422 goto IL_00dd;
2423 IL_00dd:
2424 bytesConsumed = num;
2425 value = (byte)num3;
2426 return true;
2427 IL_00d5:
2428 bytesConsumed = 0;
2429 value = 0;
2430 return false;
2431 }

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

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