arr_shCopy that doesn't compare IA
This commit is contained in:
parent
179e0a37dc
commit
1ac5f0a49d
@ -1231,7 +1231,7 @@ B bitop1(B f, B x, enum BitOp1 op, char* name) {
|
|||||||
B r; u64* rp;
|
B r; u64* rp;
|
||||||
if (v(x)->refc!=1 || (rt==t_bitarr && IS_SLICE(TY(x)))) {
|
if (v(x)->refc!=1 || (rt==t_bitarr && IS_SLICE(TY(x)))) {
|
||||||
Arr* ra = m_arr(offsetof(TyArr,a) + (n+7)/8, rt, n>>rws);
|
Arr* ra = m_arr(offsetof(TyArr,a) + (n+7)/8, rt, n>>rws);
|
||||||
arr_shCopy(ra, x);
|
arr_shCopyUnchecked(ra, x);
|
||||||
r = taga(ra); rp = tyany_ptr(r);
|
r = taga(ra); rp = tyany_ptr(r);
|
||||||
} else {
|
} else {
|
||||||
r = inc(x); rp = xp;
|
r = inc(x); rp = xp;
|
||||||
@ -1304,7 +1304,7 @@ B bitop2(B f, B w, B x, enum BitOp2 op, char* name) {
|
|||||||
x = convert((CastType){ xw, isCharType(TY(x)) }, x);
|
x = convert((CastType){ xw, isCharType(TY(x)) }, x);
|
||||||
u8 rt = typeOfCast((CastType){ rw, 0 });
|
u8 rt = typeOfCast((CastType){ rw, 0 });
|
||||||
Arr* ra = m_arr(offsetof(TyArr,a) + (n+7)/8, rt, n>>rws);
|
Arr* ra = m_arr(offsetof(TyArr,a) + (n+7)/8, rt, n>>rws);
|
||||||
arr_shCopy(ra, x);
|
arr_shCopyUnchecked(ra, x);
|
||||||
B r = taga(ra);
|
B r = taga(ra);
|
||||||
u64* wp = tyany_ptr(w);
|
u64* wp = tyany_ptr(w);
|
||||||
u64* xp = tyany_ptr(x);
|
u64* xp = tyany_ptr(x);
|
||||||
|
|||||||
@ -73,9 +73,7 @@ static void arr_shSetU(Arr* x, ur r, ShArr* sh) { // set rank and assign shape
|
|||||||
if (r>1) { x->sh = sh->a; }
|
if (r>1) { x->sh = sh->a; }
|
||||||
else { x->sh = &x->ia; }
|
else { x->sh = &x->ia; }
|
||||||
}
|
}
|
||||||
static void arr_shCopy(Arr* n, B o) { // copy shape & rank from o to n
|
static Arr* arr_shCopyUnchecked(Arr* n, B o) {
|
||||||
assert(isArr(o));
|
|
||||||
assert(IA(o)==n->ia);
|
|
||||||
ur r = SPRNK(n,RNK(o));
|
ur r = SPRNK(n,RNK(o));
|
||||||
if (r<=1) {
|
if (r<=1) {
|
||||||
n->sh = &n->ia;
|
n->sh = &n->ia;
|
||||||
@ -83,6 +81,12 @@ static void arr_shCopy(Arr* n, B o) { // copy shape & rank from o to n
|
|||||||
ptr_inc(shObj(o));
|
ptr_inc(shObj(o));
|
||||||
n->sh = SH(o);
|
n->sh = SH(o);
|
||||||
}
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
static Arr* arr_shCopy(Arr* n, B o) { // copy shape & rank from o to n
|
||||||
|
assert(isArr(o));
|
||||||
|
assert(IA(o)==n->ia);
|
||||||
|
return arr_shCopyUnchecked(n, o);
|
||||||
}
|
}
|
||||||
static void shcpy(usz* dst, usz* src, size_t len) {
|
static void shcpy(usz* dst, usz* src, size_t len) {
|
||||||
// memcpy(dst, src, len*sizeof(usz));
|
// memcpy(dst, src, len*sizeof(usz));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user