more m_arr refactoring cleanup
This commit is contained in:
parent
6799e8f078
commit
e9aff609bf
@ -21,10 +21,9 @@ static B m_c32arrc(u32** p, B x) { assert(isArr(x));
|
|||||||
arr_shCopy((Arr*)r, x);
|
arr_shCopy((Arr*)r, x);
|
||||||
return taga(r);
|
return taga(r);
|
||||||
}
|
}
|
||||||
static Arr* m_c32arrp(u32** p, usz ia) { // doesn't write shape/rank
|
static Arr* m_c32arrp(u32** p, usz ia) {
|
||||||
C32Arr* r = m_arr(C32A_SZ(ia), t_c32arr, ia);
|
C32Arr* r = m_arr(C32A_SZ(ia), t_c32arr, ia);
|
||||||
*p = r->a;
|
*p = r->a;
|
||||||
r->ia = ia;
|
|
||||||
return (Arr*)r;
|
return (Arr*)r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,10 +20,9 @@ static B m_f64arrc(f64** p, B x) { assert(isArr(x));
|
|||||||
arr_shCopy((Arr*)r, x);
|
arr_shCopy((Arr*)r, x);
|
||||||
return taga(r);
|
return taga(r);
|
||||||
}
|
}
|
||||||
static Arr* m_f64arrp(f64** p, usz ia) { // doesn't write shape/rank
|
static Arr* m_f64arrp(f64** p, usz ia) {
|
||||||
F64Arr* r = m_arr(F64A_SZ(ia), t_f64arr, ia);
|
F64Arr* r = m_arr(F64A_SZ(ia), t_f64arr, ia);
|
||||||
*p = r->a;
|
*p = r->a;
|
||||||
r->ia = ia;
|
|
||||||
return (Arr*)r;
|
return (Arr*)r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,9 +23,8 @@ static inline HArr_p harrP_parts(HArr* p) {
|
|||||||
NOINLINE void harr_pfree(B x, usz am); // am - item after last written
|
NOINLINE void harr_pfree(B x, usz am); // am - item after last written
|
||||||
|
|
||||||
|
|
||||||
static HArr_p m_harrs(usz ia, usz* ctr) { // writes just ia
|
static HArr_p m_harrs(usz ia, usz* ctr) {
|
||||||
HArr* r = m_arr(fsizeof(HArr,a,B,ia), t_harrPartial, ia);
|
HArr* r = m_arr(fsizeof(HArr,a,B,ia), t_harrPartial, ia);
|
||||||
r->ia = ia;
|
|
||||||
r->sh = ctr;
|
r->sh = ctr;
|
||||||
HArr_p rp = harrP_parts(r);
|
HArr_p rp = harrP_parts(r);
|
||||||
gsAdd(rp.b);
|
gsAdd(rp.b);
|
||||||
@ -74,9 +73,8 @@ static HArr_p m_harrUc(B x) { assert(isArr(x));
|
|||||||
arr_shCopy((Arr*)r, x);
|
arr_shCopy((Arr*)r, x);
|
||||||
return harrP_parts(r);
|
return harrP_parts(r);
|
||||||
}
|
}
|
||||||
static HArr_p m_harrUp(usz ia) { // doesn't write shape/rank
|
static HArr_p m_harrUp(usz ia) {
|
||||||
HArr* r = m_arr(fsizeof(HArr,a,B,ia), t_harr, ia);
|
HArr* r = m_arr(fsizeof(HArr,a,B,ia), t_harr, ia);
|
||||||
r->ia = ia;
|
|
||||||
return harrP_parts(r);
|
return harrP_parts(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ static B m_i32arrc(i32** p, B x) { assert(isArr(x));
|
|||||||
arr_shCopy((Arr*)r, x);
|
arr_shCopy((Arr*)r, x);
|
||||||
return taga(r);
|
return taga(r);
|
||||||
}
|
}
|
||||||
static Arr* m_i32arrp(i32** p, usz ia) { // doesn't write shape/rank
|
static Arr* m_i32arrp(i32** p, usz ia) {
|
||||||
I32Arr* r = m_arr(I32A_SZ(ia), t_i32arr, ia);
|
I32Arr* r = m_arr(I32A_SZ(ia), t_i32arr, ia);
|
||||||
*p = r->a;
|
*p = r->a;
|
||||||
return (Arr*)r;
|
return (Arr*)r;
|
||||||
|
|||||||
@ -29,8 +29,7 @@ static void mut_init(Mut* m, u8 n) {
|
|||||||
m->aB = t.c->a;
|
m->aB = t.c->a;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Arr* a = mm_alloc(sz, ty);
|
Arr* a = m_arr(sz, ty, ia);
|
||||||
a->ia = ia;
|
|
||||||
m->val = a;
|
m->val = a;
|
||||||
switch(n) { default: UD; // gcc generates horrible code for this (which should just be two instructions), but that's what gcc does
|
switch(n) { default: UD; // gcc generates horrible code for this (which should just be two instructions), but that's what gcc does
|
||||||
case el_i32: m->ai32 = ((I32Arr*)a)->a; break;
|
case el_i32: m->ai32 = ((I32Arr*)a)->a; break;
|
||||||
@ -57,7 +56,7 @@ static B mut_fcd(Mut* m, B x) { assert(m->type!=el_MAX);
|
|||||||
dec(x);
|
dec(x);
|
||||||
return taga(a);
|
return taga(a);
|
||||||
}
|
}
|
||||||
static Arr* mut_fp(Mut* m) { assert(m->type!=el_MAX); // has ia set
|
static Arr* mut_fp(Mut* m) { assert(m->type!=el_MAX);
|
||||||
return m->val;
|
return m->val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user