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

◆ TryParseSByteD()

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

Definition at line 1383 of file Utf8Parser.cs.

1384 {
1385 int num;
1386 int num2;
1387 int num4;
1388 int num3;
1389 if (source.Length >= 1)
1390 {
1391 num = 1;
1392 num2 = 0;
1393 num3 = source[num2];
1394 if (num3 == 45)
1395 {
1396 num = -1;
1397 num2++;
1398 if ((uint)num2 >= (uint)source.Length)
1399 {
1400 goto IL_0123;
1401 }
1402 num3 = source[num2];
1403 }
1404 else if (num3 == 43)
1405 {
1406 num2++;
1407 if ((uint)num2 >= (uint)source.Length)
1408 {
1409 goto IL_0123;
1410 }
1411 num3 = source[num2];
1412 }
1413 num4 = 0;
1414 if (ParserHelpers.IsDigit(num3))
1415 {
1416 if (num3 != 48)
1417 {
1418 goto IL_009c;
1419 }
1420 while (true)
1421 {
1422 num2++;
1423 if ((uint)num2 >= (uint)source.Length)
1424 {
1425 break;
1426 }
1427 num3 = source[num2];
1428 if (num3 == 48)
1429 {
1430 continue;
1431 }
1432 goto IL_0091;
1433 }
1434 goto IL_012b;
1435 }
1436 }
1437 goto IL_0123;
1438 IL_012b:
1439 bytesConsumed = num2;
1440 value = (sbyte)(num4 * num);
1441 return true;
1442 IL_009c:
1443 num4 = num3 - 48;
1444 num2++;
1445 if ((uint)num2 < (uint)source.Length)
1446 {
1447 num3 = source[num2];
1448 if (ParserHelpers.IsDigit(num3))
1449 {
1450 num2++;
1451 num4 = 10 * num4 + num3 - 48;
1452 if ((uint)num2 < (uint)source.Length)
1453 {
1454 num3 = source[num2];
1455 if (ParserHelpers.IsDigit(num3))
1456 {
1457 num2++;
1458 num4 = num4 * 10 + num3 - 48;
1459 if ((uint)num4 > 127L + (long)((-1 * num + 1) / 2) || ((uint)num2 < (uint)source.Length && ParserHelpers.IsDigit(source[num2])))
1460 {
1461 goto IL_0123;
1462 }
1463 }
1464 }
1465 }
1466 }
1467 goto IL_012b;
1468 IL_0123:
1469 bytesConsumed = 0;
1470 value = 0;
1471 return false;
1472 IL_0091:
1473 if (ParserHelpers.IsDigit(num3))
1474 {
1475 goto IL_009c;
1476 }
1477 goto IL_012b;
1478 }

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

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