Update array symbols
This commit is contained in:
+11
-11
@@ -5,29 +5,29 @@
|
||||
#include "../__internal/assert.h"
|
||||
#include "../__internal/vnode.h"
|
||||
|
||||
void* array_at(const arr_t* x, ssize_t i) {
|
||||
void* libcdsb_array_at(const arr_t* x, ssize_t i) {
|
||||
if (i < 0 && (i += x->size) < 0) i = 0;
|
||||
return x->mem + i*vtype_size(x->type);
|
||||
}
|
||||
|
||||
ssize_t array_get(arr_t* x, val_t* d, ssize_t i, _Bool cut) {
|
||||
ssize_t libcdsb_array_get(val_t* x, arr_t* s, ssize_t i, _Bool cut) {
|
||||
|
||||
if (i < 0 && (i += x->size) < 0) i = 0;
|
||||
if (i < 0 && (i += s->size) < 0) i = 0;
|
||||
|
||||
if (i < x->size) {
|
||||
assert(!is_null(x->mem));
|
||||
if (i < s->size) {
|
||||
assert(!is_null(s->mem));
|
||||
|
||||
if (cut) {
|
||||
if (!is_null(d)) {
|
||||
vnode_t n = vnode_create(array_internal_at(x, i), x->type);
|
||||
value_set(d, n, x->type, VF_WRITEABLE|VF_REMOVABLE);
|
||||
if (!is_null(x)) {
|
||||
vnode_t n = vnode_create(array_internal_at(s, i), s->type);
|
||||
value_set(x, n, s->type, VF_WRITEABLE|VF_REMOVABLE);
|
||||
}
|
||||
|
||||
array_cut(x, i, 1);
|
||||
} else value_set(d, array_internal_at(x, i), x->type, VF_WRITEABLE);
|
||||
array_cut(s, i, 1);
|
||||
} else value_set(x, array_internal_at(s, i), s->type, VF_WRITEABLE);
|
||||
} else {
|
||||
i = -1;
|
||||
memset(d, 0, sizeof(*d));
|
||||
memset(x, 0, sizeof(*x));
|
||||
}
|
||||
|
||||
return i;
|
||||
|
||||
Reference in New Issue
Block a user