Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BitStack.cs
Go to the documentation of this file.
1
namespace
System.Xml
;
2
3
internal
sealed
class
BitStack
4
{
5
private
uint[]
_bitStack
;
6
7
private
int
_stackPos
;
8
9
private
uint
_curr
;
10
11
public
BitStack
()
12
{
13
_curr
= 1
u
;
14
}
15
16
public
void
PushBit
(
bool
bit
)
17
{
18
if
((
_curr
& 0
x80000000u
) != 0)
19
{
20
PushCurr
();
21
}
22
_curr
= (
_curr
<< 1) | (
bit
? 1
u
: 0
u
);
23
}
24
25
public
bool
PopBit
()
26
{
27
bool
result = (
_curr
& 1) != 0;
28
_curr
>>= 1;
29
if
(
_curr
== 1)
30
{
31
PopCurr
();
32
}
33
return
result;
34
}
35
36
public
bool
PeekBit
()
37
{
38
return
(
_curr
& 1) != 0;
39
}
40
41
private
void
PushCurr
()
42
{
43
if
(
_bitStack
==
null
)
44
{
45
_bitStack
=
new
uint[16];
46
}
47
_bitStack
[
_stackPos
++] =
_curr
;
48
_curr
= 1
u
;
49
int
num =
_bitStack
.Length;
50
if
(
_stackPos
>= num)
51
{
52
uint[]
array
=
new
uint[2 * num];
53
Array
.
Copy
(
_bitStack
,
array
, num);
54
_bitStack
=
array
;
55
}
56
}
57
58
private
void
PopCurr
()
59
{
60
if
(
_stackPos
> 0)
61
{
62
_curr
=
_bitStack
[--
_stackPos
];
63
}
64
}
65
}
System.Array.Copy
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition
Array.cs:624
System.Array
Definition
Array.cs:16
System.Xml.BitStack.BitStack
BitStack()
Definition
BitStack.cs:11
System.Xml.BitStack.PushCurr
void PushCurr()
Definition
BitStack.cs:41
System.Xml.BitStack._curr
uint _curr
Definition
BitStack.cs:9
System.Xml.BitStack.PeekBit
bool PeekBit()
Definition
BitStack.cs:36
System.Xml.BitStack._bitStack
uint[] _bitStack
Definition
BitStack.cs:5
System.Xml.BitStack.PushBit
void PushBit(bool bit)
Definition
BitStack.cs:16
System.Xml.BitStack._stackPos
int _stackPos
Definition
BitStack.cs:7
System.Xml.BitStack.PopBit
bool PopBit()
Definition
BitStack.cs:25
System.Xml.BitStack.PopCurr
void PopCurr()
Definition
BitStack.cs:58
System.Xml.BitStack
Definition
BitStack.cs:4
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.Xml
Definition
BaseRegionIterator.cs:1
System.ExceptionArgument.array
@ array
source
System.Private.Xml
System.Xml
BitStack.cs
Generated by
1.10.0