move customizeShape into stuff.h
This commit is contained in:
parent
27b7c0746c
commit
8fd897690f
@ -55,12 +55,6 @@ B select_rows_direct(B x, ux csz, ux cam, void* inds, ux indn, u8 ie);
|
|||||||
#define SLICEI(X) ({ B r = SLICE(X, X##p); X##p+= X##_csz; r; })
|
#define SLICEI(X) ({ B r = SLICE(X, X##p); X##p+= X##_csz; r; })
|
||||||
|
|
||||||
|
|
||||||
Arr* customizeShape(B x) { // potentially copy array for shape customizing
|
|
||||||
if (reusable(x) && RNK(x)<=1) return a(x);
|
|
||||||
return TI(x,slice)(x,0,IA(x));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
B insert_base(B f, B x, bool has_w, B w) { // Used by Insert in fold.c
|
B insert_base(B f, B x, bool has_w, B w) { // Used by Insert in fold.c
|
||||||
assert(isArr(x) && RNK(x)>0);
|
assert(isArr(x) && RNK(x)>0);
|
||||||
|
|||||||
@ -574,8 +574,6 @@ static void* m_arrv_same(B* r, usz ia, B src) { // makes a new array with same e
|
|||||||
}
|
}
|
||||||
|
|
||||||
B slash_c2(B, B, B);
|
B slash_c2(B, B, B);
|
||||||
Arr* customizeShape(B x); // from cells.c
|
|
||||||
|
|
||||||
B select_cells_base(B inds, B x0, ux csz, ux cam);
|
B select_cells_base(B inds, B x0, ux csz, ux cam);
|
||||||
|
|
||||||
#define CLZC(X) (64-(CLZ((u64)(X))))
|
#define CLZC(X) (64-(CLZ((u64)(X))))
|
||||||
|
|||||||
@ -60,6 +60,11 @@ B m_vec2(B a, B b) { return m_vec2Base(a, b, false); }
|
|||||||
B pair_c1(B t, B x) { return m_vec1(x); }
|
B pair_c1(B t, B x) { return m_vec1(x); }
|
||||||
B pair_c2(B t, B w, B x) { return m_vec2Base(w, x, true); }
|
B pair_c2(B t, B w, B x) { return m_vec2Base(w, x, true); }
|
||||||
|
|
||||||
|
Arr* customizeShape(B x) {
|
||||||
|
if (reusable(x) && RNK(x)<=1) return a(x);
|
||||||
|
return TI(x,slice)(x,0,IA(x));
|
||||||
|
}
|
||||||
|
|
||||||
Arr* cpyWithShape(B x) {
|
Arr* cpyWithShape(B x) {
|
||||||
Arr* xv = a(x);
|
Arr* xv = a(x);
|
||||||
if (reusable(x)) return xv;
|
if (reusable(x)) return xv;
|
||||||
|
|||||||
@ -262,7 +262,6 @@ B mul_c2(B,B,B);
|
|||||||
B ud_c1(B,B);
|
B ud_c1(B,B);
|
||||||
B tbl_c2(Md1D*,B,B);
|
B tbl_c2(Md1D*,B,B);
|
||||||
B select_c2(B,B,B);
|
B select_c2(B,B,B);
|
||||||
Arr* customizeShape(B x); // from cells.c
|
|
||||||
|
|
||||||
static void shSet(Arr* ra, ur rr, ShArr* sh) {
|
static void shSet(Arr* ra, ur rr, ShArr* sh) {
|
||||||
if (RARE(rr <= 1)) arr_shVec(ra);
|
if (RARE(rr <= 1)) arr_shVec(ra);
|
||||||
|
|||||||
@ -198,7 +198,8 @@ B narrowWidenedBitArr(B x, ur axis, ur cr, usz* csh); // consumes x.val; undoes
|
|||||||
void bitnarrow(void* rp, ux rcsz, void* xp, ux xcsz, ux cam);
|
void bitnarrow(void* rp, ux rcsz, void* xp, ux xcsz, ux cam);
|
||||||
void bitwiden(void* rp, ux rcsz, void* xp, ux xcsz, ux cam);
|
void bitwiden(void* rp, ux rcsz, void* xp, ux xcsz, ux cam);
|
||||||
|
|
||||||
Arr* cpyWithShape(B x); // consumes; returns new array with the same shape as x; to allocate a new shape in its place, the previous one needs to be freed, rank set to 1, and then shape & rank set to the new ones
|
Arr* customizeShape(B x); // consumes; returns new array with unset shape
|
||||||
|
Arr* cpyWithShape(B x); // consumes; returns new array with the same shape as x (SH(x) will be dangling, PSH(result) must be used to access it)
|
||||||
Arr* emptyArr(B x, ur xr); // doesn't consume; returns an empty array with the same fill as x; if xr>1, shape must be set
|
Arr* emptyArr(B x, ur xr); // doesn't consume; returns an empty array with the same fill as x; if xr>1, shape must be set
|
||||||
NOINLINE Arr* emptyWithFill(B fill); // consumes; returns new array with unset shape and the specified fill
|
NOINLINE Arr* emptyWithFill(B fill); // consumes; returns new array with unset shape and the specified fill
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user