MCPcopy Create free account
hub / github.com/codr7/hacktical-c / hc_vector_insert

Function hc_vector_insert

vector/vector.c:73–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void *hc_vector_insert(struct hc_vector *v, const size_t i, const size_t n) {
74 const size_t m = v->length+n;
75 if (m > v->capacity) { hc_vector_grow(v, m); }
76 uint8_t *const p = hc_vector_get(v, i);
77
78 if (i < v->length) {
79 memmove(p + v->item_size*n, p, (v->length - i) * v->item_size);
80 }
81
82 v->length += n;
83 v->end += n*v->item_size;
84 return p;
85}
86
87bool hc_vector_delete(struct hc_vector *v, const size_t i, const size_t n) {
88 const size_t m = i+n;

Callers 4

vector_testsFunction · 0.85
memory_writeFunction · 0.85
hc_set_addFunction · 0.85
hc_vm_emitFunction · 0.85

Calls 2

hc_vector_growFunction · 0.85
hc_vector_getFunction · 0.85

Tested by 1

vector_testsFunction · 0.68