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

◆ TryParseUInt16D()

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

Definition at line 2433 of file Utf8Parser.cs.

2434 {
2435 int num;
2436 int num3;
2437 int num2;
2438 if (source.Length >= 1)
2439 {
2440 num = 0;
2441 num2 = source[num];
2442 num3 = 0;
2443 if (ParserHelpers.IsDigit(num2))
2444 {
2445 if (num2 != 48)
2446 {
2447 goto IL_0056;
2448 }
2449 while (true)
2450 {
2451 num++;
2452 if ((uint)num >= (uint)source.Length)
2453 {
2454 break;
2455 }
2456 num2 = source[num];
2457 if (num2 == 48)
2458 {
2459 continue;
2460 }
2461 goto IL_004b;
2462 }
2463 goto IL_013d;
2464 }
2465 }
2466 goto IL_0135;
2467 IL_004b:
2468 if (ParserHelpers.IsDigit(num2))
2469 {
2470 goto IL_0056;
2471 }
2472 goto IL_013d;
2473 IL_0056:
2474 num3 = num2 - 48;
2475 num++;
2476 if ((uint)num < (uint)source.Length)
2477 {
2478 num2 = source[num];
2479 if (ParserHelpers.IsDigit(num2))
2480 {
2481 num++;
2482 num3 = 10 * num3 + num2 - 48;
2483 if ((uint)num < (uint)source.Length)
2484 {
2485 num2 = source[num];
2486 if (ParserHelpers.IsDigit(num2))
2487 {
2488 num++;
2489 num3 = 10 * num3 + num2 - 48;
2490 if ((uint)num < (uint)source.Length)
2491 {
2492 num2 = source[num];
2493 if (ParserHelpers.IsDigit(num2))
2494 {
2495 num++;
2496 num3 = 10 * num3 + num2 - 48;
2497 if ((uint)num < (uint)source.Length)
2498 {
2499 num2 = source[num];
2500 if (ParserHelpers.IsDigit(num2))
2501 {
2502 num++;
2503 num3 = num3 * 10 + num2 - 48;
2504 if ((uint)num3 > 65535u || ((uint)num < (uint)source.Length && ParserHelpers.IsDigit(source[num])))
2505 {
2506 goto IL_0135;
2507 }
2508 }
2509 }
2510 }
2511 }
2512 }
2513 }
2514 }
2515 }
2516 goto IL_013d;
2517 IL_013d:
2518 bytesConsumed = num;
2519 value = (ushort)num3;
2520 return true;
2521 IL_0135:
2522 bytesConsumed = 0;
2523 value = 0;
2524 return false;
2525 }

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

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