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

◆ TryRead()

static bool System.Net.Http.VariableLengthIntegerHelper.TryRead ( ReadOnlySpan< byte > buffer,
out long value,
out int bytesRead )
inlinestatic

Definition at line 7 of file VariableLengthIntegerHelper.cs.

8 {
9 if (buffer.Length != 0)
10 {
11 byte b = buffer[0];
12 switch (b & 0xC0)
13 {
14 case 0:
15 value = b;
16 bytesRead = 1;
17 return true;
18 case 64:
19 {
21 {
22 value = (uint)(value3 - 16384);
23 bytesRead = 2;
24 return true;
25 }
26 break;
27 }
28 case 128:
29 {
31 {
32 value = (uint)((int)value4 - int.MinValue);
33 bytesRead = 4;
34 return true;
35 }
36 break;
37 }
38 default:
39 {
41 {
42 value = (long)value2 - -4611686018427387904L;
43 bytesRead = 8;
44 return true;
45 }
46 break;
47 }
48 }
49 }
50 value = 0L;
51 bytesRead = 0;
52 return false;
53 }
static bool TryReadUInt32BigEndian(ReadOnlySpan< byte > source, out uint value)
static bool TryReadUInt64BigEndian(ReadOnlySpan< byte > source, out ulong value)
static bool TryReadUInt16BigEndian(ReadOnlySpan< byte > source, out ushort value)

References System.buffer, System.L, System.Buffers.Binary.BinaryPrimitives.TryReadUInt16BigEndian(), System.Buffers.Binary.BinaryPrimitives.TryReadUInt32BigEndian(), System.Buffers.Binary.BinaryPrimitives.TryReadUInt64BigEndian(), and System.value.

Referenced by System.Net.Http.Http3Connection.ProcessServerControlStreamAsync(), System.Net.Http.Http3Connection.ProcessServerStreamAsync(), and System.Net.Http.Http3Frame.TryReadIntegerPair().