MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / builtin_array_erase

Function builtin_array_erase

src/builtin/module_builtin_array.cpp:77–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 }
76
77 void builtin_array_erase ( Array & pArray, int index, int stride, Context * context, LineInfoArg * at ) {
78 if ( index < 0 || uint64_t(index) >= pArray.size ) {
79 context->throw_error_at(at, "erase index out of range, %d of %llu", index, (unsigned long long)pArray.size);
80 return;
81 }
82 memmove ( pArray.data+index*stride, pArray.data+(index+1)*stride, size_t(pArray.size-uint64_t(index)-1)*size_t(stride) );
83 array_resize(*context, pArray, pArray.size-1, stride, false, at);
84 }
85
86 void builtin_array_erase_range ( Array & pArray, int index, int count, int stride, Context * context, LineInfoArg * at ) {
87 // Compute end as uint64 sum AFTER non-negativity check to avoid signed overflow UB on index+count.

Callers

nothing calls this directly

Calls 2

array_resizeFunction · 0.85
throw_error_atMethod · 0.80

Tested by

no test coverage detected