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

◆ TryReadUnsignedInteger()

static bool System.Formats.Asn1.AsnDecoder.TryReadUnsignedInteger ( ReadOnlySpan< byte > source,
AsnEncodingRules ruleSet,
int sizeLimit,
Asn1Tag expectedTag,
UniversalTagNumber tagNumber,
out ulong value,
out int bytesConsumed )
inlinestaticprivate

Definition at line 1038 of file AsnDecoder.cs.

1039 {
1040 int bytesConsumed2;
1042 if ((readOnlySpan[0] & 0x80u) != 0)
1043 {
1044 bytesConsumed = 0;
1045 value = 0uL;
1046 return false;
1047 }
1048 if (readOnlySpan.Length > 1 && readOnlySpan[0] == 0)
1049 {
1050 readOnlySpan = readOnlySpan.Slice(1);
1051 }
1052 if (readOnlySpan.Length > sizeLimit)
1053 {
1054 bytesConsumed = 0;
1055 value = 0uL;
1056 return false;
1057 }
1058 ulong num = 0uL;
1059 for (int i = 0; i < readOnlySpan.Length; i++)
1060 {
1061 num <<= 8;
1062 num |= readOnlySpan[i];
1063 }
1065 value = num;
1066 return true;
1067 }
static ReadOnlySpan< byte > GetIntegerContents(ReadOnlySpan< byte > source, AsnEncodingRules ruleSet, Asn1Tag expectedTag, UniversalTagNumber tagNumber, out int bytesConsumed)

References System.Formats.Asn1.AsnDecoder.GetIntegerContents(), System.source, and System.value.

Referenced by System.Formats.Asn1.AsnDecoder.ReadEnumeratedValue(), System.Formats.Asn1.AsnDecoder.TryReadUInt32(), and System.Formats.Asn1.AsnDecoder.TryReadUInt64().