Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IntegerDecoder.cs
Go to the documentation of this file.
2
4
5internal struct IntegerDecoder
6{
7 private int _i;
8
9 private int _m;
10
11 public bool BeginTryDecode(byte b, int prefixLength, out int result)
12 {
13 if (b < (1 << prefixLength) - 1)
14 {
15 result = b;
16 return true;
17 }
18 _i = b;
19 _m = 0;
20 result = 0;
21 return false;
22 }
23
24 public bool TryDecode(byte b, out int result)
25 {
27 {
29 }
30 _i += (b & 0x7F) << _m;
31 if (_i < 0)
32 {
34 }
35 _m += 7;
36 if ((b & 0x80) == 0)
37 {
38 if (b == 0 && _m / 7 > 1)
39 {
41 }
42 result = _i;
43 return true;
44 }
45 result = 0;
46 return false;
47 }
48}
static int LeadingZeroCount(uint value)
static string net_http_hpack_bad_integer
Definition SR.cs:166
Definition SR.cs:7
bool BeginTryDecode(byte b, int prefixLength, out int result)
bool TryDecode(byte b, out int result)