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

Method Splice

src/Array.cpp:357–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357void ArrayBase::Splice(ArrayBase *outResult,int inPos,int inLen)
358{
359 if (inPos>=length)
360 {
361 return;
362 }
363 else if (inPos<0)
364 {
365 inPos += length;
366 if (inPos<0)
367 inPos =0;
368 }
369 if (inLen<=0)
370 return;
371 if (inPos+inLen>length)
372 inLen = length - inPos;
373
374 int s = GetElementSize();
375 if (outResult)
376 {
377 outResult->resize(inLen);
378 memcpy(outResult->mBase, mBase+inPos*s, s*inLen);
379 // todo - only needed if we have dirty pointer elements
380 HX_OBJ_WB_PESSIMISTIC_GET(outResult);
381 }
382 memmove(mBase+inPos*s, mBase + (inPos+inLen)*s, (length-(inPos+inLen))*s);
383 resize(length-inLen);
384}
385
386void ArrayBase::Slice(ArrayBase *outResult,int inPos,int inEnd)
387{

Callers

nothing calls this directly

Calls 3

memcpyFunction · 0.85
GetElementSizeFunction · 0.50
resizeFunction · 0.50

Tested by

no test coverage detected