Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ByteStack.cs
Go to the documentation of this file.
1namespace System.Xml;
2
3internal sealed class ByteStack
4{
5 private byte[] _stack;
6
7 private readonly int _growthRate;
8
9 private int _top;
10
11 private int _size;
12
14 {
16 _top = 0;
17 _stack = new byte[growthRate];
19 }
20
21 public void Push(byte data)
22 {
23 if (_size == _top)
24 {
25 byte[] array = new byte[_size + _growthRate];
26 if (_top > 0)
27 {
29 }
30 _stack = array;
32 }
33 _stack[_top++] = data;
34 }
35
36 public byte Pop()
37 {
38 if (_top > 0)
39 {
40 return _stack[--_top];
41 }
42 return 0;
43 }
44}
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
Definition Buffer.cs:102
void Push(byte data)
Definition ByteStack.cs:21
ByteStack(int growthRate)
Definition ByteStack.cs:13
readonly int _growthRate
Definition ByteStack.cs:7