MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / Blit

Method Blit

src/Array.cpp:239–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void ArrayBase::Blit(int inDestElement, ArrayBase *inSourceArray, int inSourceElement, int inElementCount)
240{
241 int srcSize = inSourceArray->GetElementSize();
242 int srcElems = inSourceArray->length;
243 if (inDestElement<0 || inSourceElement<0 || inSourceElement+inElementCount>srcElems)
244 hx::Throw( HX_CSTRING("blit out of bounds") );
245 if (srcSize!=GetElementSize())
246 hx::Throw( HX_CSTRING("blit array mismatch") );
247
248 int newSize = inDestElement + inElementCount;
249 if (newSize>length)
250 resize(newSize);
251
252 const char *src = inSourceArray->mBase + inSourceElement*srcSize;
253 char *dest = mBase + inDestElement*srcSize;
254 int len = inElementCount*srcSize;
255 if (src+len < dest || dest+len<src)
256 memcpy(dest,src,len);
257 else
258 memmove(dest,src,len);
259
260 HX_OBJ_WB_PESSIMISTIC_GET(this);
261}
262
263int ArrayBase::__Compare(const hx::Object *inRHS) const
264{

Callers

nothing calls this directly

Calls 4

ThrowFunction · 0.85
memcpyFunction · 0.85
GetElementSizeFunction · 0.50
resizeFunction · 0.50

Tested by

no test coverage detected