actually a generic arr_ptr is maybe not a sane thing
This commit is contained in:
parent
1c20f3eac5
commit
d79bdafaa8
@ -34,12 +34,6 @@ static void* tyslicev_ptr(Arr* x) {
|
|||||||
static void* tyarr_ptr(B x) { return tyarrv_ptr(c(TyArr,x)); }
|
static void* tyarr_ptr(B x) { return tyarrv_ptr(c(TyArr,x)); }
|
||||||
static void* tyany_ptr(B x) { return tyanyv_ptr(a(x)); }
|
static void* tyany_ptr(B x) { return tyanyv_ptr(a(x)); }
|
||||||
|
|
||||||
static void* arr_ptr(Arr* t, u8 el) {
|
|
||||||
return el==el_B? (void*)harrv_ptr(t) : tyarrv_ptr((TyArr*)t);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define M_TYARR(WM, OVER, MID, RV, PRE) { PRE \
|
#define M_TYARR(WM, OVER, MID, RV, PRE) { PRE \
|
||||||
Arr* r = m_arr((offsetof(TyArr, a) + ( \
|
Arr* r = m_arr((offsetof(TyArr, a) + ( \
|
||||||
WM==0? ((u64)ia)*w \
|
WM==0? ((u64)ia)*w \
|
||||||
|
|||||||
@ -39,13 +39,17 @@ NOINLINE Mut make_mut_init(u64 ia, u8 el) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void* harr_tyarr_ptr(Arr* t, u8 el) {
|
||||||
|
return el==el_B? (void*)harrv_ptr(t) : tyarrv_ptr((TyArr*)t);
|
||||||
|
}
|
||||||
|
|
||||||
INIT_GLOBAL u8 reuseElType[t_COUNT];
|
INIT_GLOBAL u8 reuseElType[t_COUNT];
|
||||||
void mut_init_copy(Mut* m, B x, u8 el) {
|
void mut_init_copy(Mut* m, B x, u8 el) {
|
||||||
assert(m->fns == &mutFns[el_MAX]);
|
assert(m->fns == &mutFns[el_MAX]);
|
||||||
if (reusable(x) && reuseElType[TY(x)]==el) {
|
if (reusable(x) && reuseElType[TY(x)]==el) {
|
||||||
m->fns = &mutFns[el];
|
m->fns = &mutFns[el];
|
||||||
Arr* a = m->val = a(REUSE(x));
|
Arr* a = m->val = a(REUSE(x));
|
||||||
m->a = arr_ptr(a, el);
|
m->a = harr_tyarr_ptr(a, el);
|
||||||
} else {
|
} else {
|
||||||
mut_to(m, el);
|
mut_to(m, el);
|
||||||
mut_copy(m, 0, x, 0, IA(x));
|
mut_copy(m, 0, x, 0, IA(x));
|
||||||
@ -82,7 +86,7 @@ NOINLINE void mut_to(Mut* m, u8 n) {
|
|||||||
#endif
|
#endif
|
||||||
Arr* t = cpyFns[n](taga(m->val));
|
Arr* t = cpyFns[n](taga(m->val));
|
||||||
m->val = t;
|
m->val = t;
|
||||||
m->a = arr_ptr(t, n);
|
m->a = harr_tyarr_ptr(t, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user