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

◆ ReadSubIdentifier()

static void System.Formats.Asn1.AsnDecoder.ReadSubIdentifier ( ReadOnlySpan< byte > source,
out int bytesRead,
out long? smallValue,
out BigInteger? largeValue )
inlinestaticprivate

Definition at line 1421 of file AsnDecoder.cs.

1422 {
1423 if (source[0] == 128)
1424 {
1425 throw new AsnContentException();
1426 }
1427 int num = -1;
1428 int i;
1429 for (i = 0; i < source.Length; i++)
1430 {
1431 if ((source[i] & 0x80) == 0)
1432 {
1433 num = i;
1434 break;
1435 }
1436 }
1437 if (num < 0)
1438 {
1439 throw new AsnContentException();
1440 }
1441 bytesRead = num + 1;
1442 long num2 = 0L;
1443 if (bytesRead <= 9)
1444 {
1445 for (i = 0; i < bytesRead; i++)
1446 {
1447 byte b = source[i];
1448 num2 <<= 7;
1449 num2 |= (byte)(b & 0x7F);
1450 }
1451 largeValue = null;
1452 smallValue = num2;
1453 return;
1454 }
1455 int num3 = (bytesRead / 8 + 1) * 7;
1457 Array.Clear(array, 0, array.Length);
1460 int num4 = bytesRead;
1461 i = bytesRead - 8;
1462 while (num4 > 0)
1463 {
1464 byte b2 = source[i];
1465 num2 <<= 7;
1466 num2 |= (byte)(b2 & 0x7F);
1467 i++;
1468 if (i >= num4)
1469 {
1471 destination2.Slice(0, 7).CopyTo(destination);
1472 destination = destination.Slice(7);
1473 num2 = 0L;
1474 num4 -= 8;
1475 i = Math.Max(0, num4 - 8);
1476 }
1477 }
1478 int num5 = array.Length - destination.Length;
1479 int num6 = num3 - num5;
1481 smallValue = null;
1483 }
static void WriteInt64LittleEndian(Span< byte > destination, long value)
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
static void Return(byte[] array, int clearSize=-1)
Definition CryptoPool.cs:12
static byte[] Rent(int minimumLength)
Definition CryptoPool.cs:7

References System.array, System.Array.Clear(), System.Collections.Generic.Dictionary< TKey, TValue >.CopyTo(), System.destination, System.L, System.Math.Max(), System.Security.Cryptography.CryptoPool.Rent(), System.Security.Cryptography.CryptoPool.Return(), System.source, and System.Buffers.Binary.BinaryPrimitives.WriteInt64LittleEndian().

Referenced by System.Formats.Asn1.AsnDecoder.ReadObjectIdentifier().