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);
|
||||
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);
|
||||
*p = r->a;
|
||||
r->ia = ia;
|
||||
return (Arr*)r;
|
||||
}
|
||||
|
||||
|
||||
@ -20,10 +20,9 @@ static B m_f64arrc(f64** p, B x) { assert(isArr(x));
|
||||
arr_shCopy((Arr*)r, x);
|
||||
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);
|
||||
*p = r->a;
|
||||
r->ia = ia;
|
||||
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
|
||||
|
||||
|
||||
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);
|
||||
r->ia = ia;
|
||||
r->sh = ctr;
|
||||
HArr_p rp = harrP_parts(r);
|
||||
gsAdd(rp.b);
|
||||
@ -74,9 +73,8 @@ static HArr_p m_harrUc(B x) { assert(isArr(x));
|
||||
arr_shCopy((Arr*)r, x);
|
||||
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);
|
||||
r->ia = ia;
|
||||
return harrP_parts(r);
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ static B m_i32arrc(i32** p, B x) { assert(isArr(x));
|
||||
arr_shCopy((Arr*)r, x);
|
||||
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);
|
||||
*p = r->a;
|
||||
return (Arr*)r;
|
||||
|
||||
@ -29,8 +29,7 @@ static void mut_init(Mut* m, u8 n) {
|
||||
m->aB = t.c->a;
|
||||
return;
|
||||
}
|
||||
Arr* a = mm_alloc(sz, ty);
|
||||
a->ia = ia;
|
||||
Arr* a = m_arr(sz, ty, ia);
|
||||
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
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user