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

◆ EnsureAvailableSpace() [2/2]

void System.Net.ArrayBuffer.EnsureAvailableSpace ( int byteCount)
inline

Definition at line 62 of file ArrayBuffer.cs.

63 {
65 {
66 return;
67 }
68 int num = _activeStart + AvailableLength;
69 if (byteCount <= num)
70 {
73 _activeStart = 0;
74 return;
75 }
76 int num2 = ActiveLength + byteCount;
77 int num3 = _bytes.Length;
78 do
79 {
80 num3 *= 2;
81 }
82 while (num3 < num2);
83 byte[] array = (_usePool ? ArrayPool<byte>.Shared.Rent(num3) : new byte[num3]);
84 byte[] bytes = _bytes;
85 if (ActiveLength != 0)
86 {
88 }
90 _activeStart = 0;
91 _bytes = array;
92 if (_usePool)
93 {
95 }
96 }
static ArrayPool< T > Shared
Definition ArrayPool.cs:7
readonly bool _usePool
Definition ArrayBuffer.cs:9

References System.Net.ArrayBuffer._activeStart, System.Net.ArrayBuffer._availableStart, System.Net.ArrayBuffer._bytes, System.Net.ArrayBuffer._usePool, System.Net.ArrayBuffer.ActiveLength, System.array, System.Net.ArrayBuffer.AvailableLength, System.Buffer.BlockCopy(), System.byteCount, System.bytes, and System.Buffers.ArrayPool< T >.Shared.