MCPcopy Create free account
hub / github.com/beefytech/Beef / FastRead

Method FastRead

BeefySysLib/util/ChunkedDataBuffer.cpp:183–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void* ChunkedDataBuffer::FastRead(void * data, int size)
184{
185 // Fast case- no crossing chunk boundary
186 if (mReadCurPtr + size <= mReadNextAlloc)
187 {
188 void* retVal = mReadCurPtr;
189 mReadCurPtr += size;
190 return retVal;
191 }
192
193 void* dataHead = data;
194 while (mReadCurPtr + size > mReadNextAlloc)
195 {
196 int curSize = (int)(mReadNextAlloc - mReadCurPtr);
197 if (curSize > 0)
198 memcpy(data, mReadCurPtr, curSize);
199
200 NextReadPool();
201 data = (uint8*)data + curSize;
202 size -= curSize;
203 }
204
205 memcpy(data, mReadCurPtr, size);
206 mReadCurPtr += size;
207 return dataHead;
208}
209
210uint8 ChunkedDataBuffer::Read()
211{

Callers 1

WriteTypeDataMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected