MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / Reserve

Method Reserve

projects/CSharp/Proto/com.chronoxor.fbe.cs:195–207  ·  view source on GitHub ↗

Reserve memory of the given capacity in the current buffer

(long capacity)

Source from the content-addressed store, hash-verified

193
194 // Reserve memory of the given capacity in the current buffer
195 public void Reserve(long capacity)
196 {
197 Debug.Assert((capacity >= 0), "Invalid reserve capacity!");
198 if (capacity < 0)
199 throw new ArgumentException("Invalid reserve capacity!", nameof(capacity));
200
201 if (capacity > Capacity)
202 {
203 byte[] data = new byte[Math.Max(capacity, 2 * Capacity)];
204 Array.Copy(_data, 0, data, 0, _size);
205 _data = data;
206 }
207 }
208
209 // Resize the current buffer
210 public void Resize(long size)

Callers

nothing calls this directly

Calls 1

CopyMethod · 0.45

Tested by

no test coverage detected