BB2B & BBB2B → FC1 & FC2
This commit is contained in:
parent
ca13fb567a
commit
aa5ed7cc7a
@ -49,8 +49,8 @@ enum PrimNumbers {
|
||||
/* ´˝`∘○⊸⟜⌾⊘◶ */ n_fold , n_insert , n_scan , n_atop , n_over , n_before , n_after , n_under, n_val , n_cond,
|
||||
/* ⎉⚇⍟⎊ */ n_rank , n_depth , n_repeat, n_catch
|
||||
};
|
||||
extern BB2B rt_invFnRegFn;
|
||||
extern BB2B rt_invFnSwapFn;
|
||||
extern FC1 rt_invFnRegFn;
|
||||
extern FC1 rt_invFnSwapFn;
|
||||
|
||||
|
||||
#ifdef RT_WRAP
|
||||
|
||||
@ -231,7 +231,7 @@ static B modint_AS(B w, B xv) { return modint_AA(w, C2(shape, C1(fne, incG(w))
|
||||
#undef SA_DISPATCH
|
||||
|
||||
#else
|
||||
static NOINLINE B bit_sel1Fn(BBB2B f, B w, B x, bool bitX) { // consumes both
|
||||
static NOINLINE B bit_sel1Fn(FC2 f, B w, B x, bool bitX) { // consumes both
|
||||
B b = bitX? x : w;
|
||||
u64* bp = bitarr_ptr(b);
|
||||
usz ia = IA(b);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "../ns.h"
|
||||
#include <math.h>
|
||||
|
||||
static inline B arith_recm(BB2B f, B x) {
|
||||
static inline B arith_recm(FC1 f, B x) {
|
||||
B fx = getFillQ(x);
|
||||
B r = eachm_fn(bi_N, x, f);
|
||||
return withFill(r, fx);
|
||||
@ -146,7 +146,7 @@ f64 fact_inv(f64 y) { return logfact_inv(log(y)); }
|
||||
B pow_c1(B t, B x) { if (isF64(x)) return m_f64( exp(x.f)); P1( pow); thrM("⋆: Argument contained non-number"); }
|
||||
B log_c1(B t, B x) { if (isF64(x)) return m_f64( log(x.f)); P1( log); thrM("⋆⁼: Argument contained non-number"); }
|
||||
#undef P1
|
||||
static NOINLINE B arith_recm_slow(f64 (*fn)(f64), BB2B rec, B x, char* s) {
|
||||
static NOINLINE B arith_recm_slow(f64 (*fn)(f64), FC1 rec, B x, char* s) {
|
||||
if (isF64(x)) return m_f64(fn(x.f));
|
||||
if(isArr(x)) return arith_recm(rec, x);
|
||||
thrF("•math.%S: Argument contained non-number", s);
|
||||
|
||||
@ -48,7 +48,7 @@ B insert_base(B f, B x, usz xia, bool has_w, B w) {
|
||||
p -= x_csz;
|
||||
r = SLICE(x, p);
|
||||
}
|
||||
BBB2B fc2 = c2fn(f);
|
||||
FC2 fc2 = c2fn(f);
|
||||
while(p!=0) {
|
||||
p-= x_csz;
|
||||
r = fc2(f, SLICE(x, p), r);
|
||||
@ -384,7 +384,7 @@ B for_cells_c1(B f, u32 xr, u32 cr, u32 k, B x, u32 chr) { // F⎉cr x, with arr
|
||||
base:;
|
||||
|
||||
M_APD_SH(r, k, xsh);
|
||||
S_KSLICES(x, xsh, k, cam, 1); BB2B fc1 = c1fn(f);
|
||||
S_KSLICES(x, xsh, k, cam, 1); FC1 fc1 = c1fn(f);
|
||||
for (usz i=0,xp=0; i<cam; i++) APDD(r, fc1(f, SLICEI(x)));
|
||||
decG(x);
|
||||
|
||||
@ -444,7 +444,7 @@ NOINLINE B for_cells_AS(B f, B w, B x, ur wcr, ur wr, u32 chr) {
|
||||
usz* wsh=SH(w); usz cam=shProd(wsh,0,wk);
|
||||
if (cam==0) return rank2_empty(f, w, wk, x, 0, chr);
|
||||
S_KSLICES(w, wsh, wk, cam, 1) incBy(x, cam-1);
|
||||
M_APD_SH(r, wk, wsh); BBB2B fc2 = c2fn(f);
|
||||
M_APD_SH(r, wk, wsh); FC2 fc2 = c2fn(f);
|
||||
for (usz i=0,wp=0; i<cam; i++) APDD(r, fc2(f, SLICEI(w), x));
|
||||
decG(w); return taga(APD_SH_GET(r, chr));
|
||||
}
|
||||
@ -465,7 +465,7 @@ NOINLINE B for_cells_SA(B f, B w, B x, ur xcr, ur xr, u32 chr) {
|
||||
if (rtid==n_transp && q_usz(w)) { usz a=o2sG(w); if (a<xr-1) return transp_cells(a+1, 1, x); }
|
||||
}
|
||||
S_KSLICES(x, xsh, xk, cam, 1) incBy(w, cam-1);
|
||||
M_APD_SH(r, xk, xsh); BBB2B fc2 = c2fn(f);
|
||||
M_APD_SH(r, xk, xsh); FC2 fc2 = c2fn(f);
|
||||
for (usz i=0,xp=0; i<cam; i++) APDD(r, fc2(f, w, SLICEI(x)));
|
||||
decG(x); return taga(APD_SH_GET(r, chr));
|
||||
}
|
||||
@ -501,7 +501,7 @@ NOINLINE B for_cells_AA(B f, B w, B x, ur wcr, ur xcr, u32 chr) {
|
||||
M_APD_SH(r, zk, zsh);
|
||||
S_KSLICES(w, wsh, wk, xkM? cam0 : cam, 1) usz wp = 0;
|
||||
S_KSLICES(x, xsh, xk, xkM? cam : cam0, 1) usz xp = 0;
|
||||
BBB2B fc2 = c2fn(f);
|
||||
FC2 fc2 = c2fn(f);
|
||||
if (ext==1) { for (usz i=0; i<cam; i++) APDD(r, fc2(f, SLICEI(w), SLICEI(x))); }
|
||||
else if (xkM) { for (usz i=0; i<cam; ) { B wb=incByG(SLICEI(w), ext-1); for (usz e = i+ext; i < e; i++) APDD(r, fc2(f, wb, SLICEI(x))); } }
|
||||
else { for (usz i=0; i<cam; ) { B xb=incByG(SLICEI(x), ext-1); for (usz e = i+ext; i < e; i++) APDD(r, fc2(f, SLICEI(w), xb)); } }
|
||||
|
||||
@ -84,9 +84,9 @@ CMP_REC(ne, ne, swapped=0;)
|
||||
#undef CMP_AA_F
|
||||
|
||||
|
||||
#define CMP_SLOW(T, GW) void cmp_slow_##T(void* r, void* w, B x, u64 l, BBB2B fn) { \
|
||||
#define CMP_SLOW(T, GW) void cmp_slow_##T(void* r, void* w, B x, u64 l, FC2 fc2) { \
|
||||
assert(l>0); incBy(x,l-1); \
|
||||
for (usz i=0; i<l; i++) bitp_set(r, i, o2bG(fn(m_f64(0), GW, x))); \
|
||||
for (usz i=0; i<l; i++) bitp_set(r, i, o2bG(fc2(m_f64(0), GW, x))); \
|
||||
}
|
||||
#define CMP_SLOWi(T,M) CMP_SLOW(T, m_##M(((T*)w)[i]))
|
||||
CMP_SLOW(u1,m_i32(bitp_get(w,i)))
|
||||
|
||||
@ -218,7 +218,7 @@ B fold_c1(Md1D* d, B x) { B f = d->f;
|
||||
SLOW2("𝕎´ 𝕩", f, x);
|
||||
|
||||
SGet(x)
|
||||
BBB2B fc2 = c2fn(f);
|
||||
FC2 fc2 = c2fn(f);
|
||||
B c;
|
||||
if (TI(x,elType)==el_i32) {
|
||||
i32* xp = i32any_ptr(x);
|
||||
@ -285,7 +285,7 @@ B fold_c2(Md1D* d, B w, B x) { B f = d->f;
|
||||
|
||||
B c = w;
|
||||
SGet(x)
|
||||
BBB2B fc2 = c2fn(f);
|
||||
FC2 fc2 = c2fn(f);
|
||||
for (usz i = ia; i>0; i--) c = fc2(f, Get(x, i-1), c);
|
||||
decG(x);
|
||||
return c;
|
||||
|
||||
@ -71,7 +71,7 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f;
|
||||
B r;
|
||||
usz* rsh;
|
||||
|
||||
BBB2B fc2 = c2fn(f);
|
||||
FC2 fc2 = c2fn(f);
|
||||
if (isFun(f) && TI(w,arrD1) && isPervasiveDyExt(f)) {
|
||||
if (TI(x,arrD1) && wia>130 && xia<2560>>arrTypeBitsLog(TY(x))) {
|
||||
Arr* wd = arr_shVec(TI(w,slice)(incG(w), 0, wia));
|
||||
|
||||
@ -185,14 +185,14 @@ B before_uc1(Md2* t, B o, B f, B g, B x) {
|
||||
|
||||
|
||||
B while_c1(Md2D* d, B x) { B f=d->f; B g=d->g;
|
||||
BB2B ff = c1fn(f);
|
||||
BB2B gf = c1fn(g);
|
||||
FC1 ff = c1fn(f);
|
||||
FC1 gf = c1fn(g);
|
||||
while (o2b(gf(g,inc(x)))) x = ff(f, x);
|
||||
return x;
|
||||
}
|
||||
B while_c2(Md2D* d, B w, B x) { B f=d->f; B g=d->g;
|
||||
BBB2B ff = c2fn(f);
|
||||
BBB2B gf = c2fn(g);
|
||||
FC2 ff = c2fn(f);
|
||||
FC2 gf = c2fn(g);
|
||||
while (o2b(gf(g,inc(w),inc(x)))) x = ff(f, inc(w), x);
|
||||
dec(w);
|
||||
return x;
|
||||
|
||||
@ -218,7 +218,7 @@ B scan_c1(Md1D* d, B x) { B f = d->f;
|
||||
bool reuse = TY(x)==t_harr && reusable(x);
|
||||
HArr_p r = reuse? harr_parts(REUSE(x)) : m_harr0c(x);
|
||||
AS2B xget = reuse? TI(x,getU) : TI(x,get); Arr* xa = a(x);
|
||||
BBB2B fc2 = c2fn(f);
|
||||
FC2 fc2 = c2fn(f);
|
||||
|
||||
if (xr==1) {
|
||||
r.a[0] = xget(xa,0);
|
||||
@ -283,7 +283,7 @@ B scan_c2(Md1D* d, B w, B x) { B f = d->f;
|
||||
usz i = 0;
|
||||
HArr_p r = reuse? harr_parts(REUSE(x)) : m_harr0c(x);
|
||||
AS2B xget = reuse? TI(x,getU) : TI(x,get); Arr* xa = a(x);
|
||||
BBB2B fc2 = c2fn(f);
|
||||
FC2 fc2 = c2fn(f);
|
||||
|
||||
if (isArr(w)) {
|
||||
ur wr = RNK(w); usz* wsh = SH(w); SGet(w)
|
||||
|
||||
@ -33,11 +33,11 @@
|
||||
typedef struct BFn {
|
||||
struct Fun;
|
||||
B ident;
|
||||
BBB2B uc1;
|
||||
FC2 uc1;
|
||||
BBBB2B ucw;
|
||||
BB2B im;
|
||||
BBB2B iw; B rtInvSwap;
|
||||
BBB2B ix; B rtInvReg;
|
||||
FC1 im;
|
||||
FC2 iw; B rtInvSwap;
|
||||
FC2 ix; B rtInvReg;
|
||||
} BFn;
|
||||
typedef struct BMd1 {
|
||||
struct Md1;
|
||||
|
||||
@ -322,12 +322,12 @@ B md_c1(B t, B x);
|
||||
B md_c2(B t, B w, B x);
|
||||
B arr_c1(B t, B x);
|
||||
B arr_c2(B t, B w, B x);
|
||||
static BB2B c1fn(B f) {
|
||||
static FC1 c1fn(B f) {
|
||||
if (isFun(f)) return c(Fun,f)->c1;
|
||||
if (isMd(f)) return md_c1;
|
||||
return arr_c1;
|
||||
}
|
||||
static BBB2B c2fn(B f) {
|
||||
static FC2 c2fn(B f) {
|
||||
if (isFun(f)) return c(Fun,f)->c2;
|
||||
if (isMd(f)) return md_c2;
|
||||
return arr_c2;
|
||||
|
||||
@ -165,7 +165,7 @@ typedef BQNV (*bqn_foreignFn2)(BQNV w, BQNV x);
|
||||
B directFn_c1(B t, B x) { BoundFn* c = c(BoundFn,t); return getB(((bqn_foreignFn1)c->w_c1)( makeX(x))); }
|
||||
B directFn_c2(B t, B w, B x) { BoundFn* c = c(BoundFn,t); return getB(((bqn_foreignFn2)c->w_c2)(makeX(w), makeX(x))); }
|
||||
|
||||
static B m_ffiFn(NFnDesc* desc, B obj, BB2B c1, BBB2B c2, void* wc1, void* wc2) {
|
||||
static B m_ffiFn(NFnDesc* desc, B obj, FC1 c1, FC2 c2, void* wc1, void* wc2) {
|
||||
BoundFn* r = mm_alloc(sizeof(BoundFn), t_nfn);
|
||||
nfn_lateInit((NFn*)r, desc);
|
||||
r->obj = obj;
|
||||
|
||||
27
src/h.h
27
src/h.h
@ -533,6 +533,9 @@ typedef B (* B2B)(B);
|
||||
typedef B (* BB2B)(B, B);
|
||||
typedef B (* BBB2B)(B, B, B);
|
||||
typedef B (* BBBB2B)(B, B, B, B);
|
||||
typedef BB2B FC1;
|
||||
typedef BBB2B FC2;
|
||||
|
||||
|
||||
typedef B (*M1C3)(Md1*, B, B, B);
|
||||
typedef B (*M1C4)(Md1*, B, B, B, B);
|
||||
@ -560,16 +563,16 @@ typedef B (*D2C2)(Md2D*, B, B);
|
||||
F(M2C4, m2_uc1) /* t,o,f,g, x→r; r≡O⌾( F _T_ G ) x; consumes x */ \
|
||||
F(M2C5, m2_ucw) /* t,o,f,g,w,x→r; r≡O⌾(w⊸(F _T_ G)) x; consumes w,x */ \
|
||||
\
|
||||
F( BB2B, fn_im) /* t, x; function monadic inverse; consumes x */ \
|
||||
F( BB2B, fn_is) /* t, x; function equal-arg inverse; consumes x */ \
|
||||
F(BBB2B, fn_iw) /* t,w,x; function dyadic 𝕨-inverse; consumes w,x */ \
|
||||
F(BBB2B, fn_ix) /* t,w,x; function dyadic 𝕩-inverse; consumes w,x */ \
|
||||
F( D1C1, m1_im) /* d, x; 1-modifier monadic inverse; consumes x */ \
|
||||
F( D1C2, m1_iw) /* d,w,x; 1-modifier dyadic 𝕨-inverse; consumes w,x */ \
|
||||
F( D1C2, m1_ix) /* d,w,x; 1-modifier dyadic 𝕩-inverse; consumes w,x */ \
|
||||
F( D2C1, m2_im) /* d, x; 2-modifier monadic inverse; consumes x */ \
|
||||
F( D2C2, m2_iw) /* d,w,x; 2-modifier dyadic 𝕨-inverse; consumes w,x */ \
|
||||
F( D2C2, m2_ix) /* d,w,x; 2-modifier dyadic 𝕩-inverse; consumes w,x */ \
|
||||
F(FC1, fn_im) /* t, x; function monadic inverse; consumes x */ \
|
||||
F(FC1, fn_is) /* t, x; function equal-arg inverse; consumes x */ \
|
||||
F(FC2, fn_iw) /* t,w,x; function dyadic 𝕨-inverse; consumes w,x */ \
|
||||
F(FC2, fn_ix) /* t,w,x; function dyadic 𝕩-inverse; consumes w,x */ \
|
||||
F(D1C1, m1_im) /* d, x; 1-modifier monadic inverse; consumes x */ \
|
||||
F(D1C2, m1_iw) /* d,w,x; 1-modifier dyadic 𝕨-inverse; consumes w,x */ \
|
||||
F(D1C2, m1_ix) /* d,w,x; 1-modifier dyadic 𝕩-inverse; consumes w,x */ \
|
||||
F(D2C1, m2_im) /* d, x; 2-modifier monadic inverse; consumes x */ \
|
||||
F(D2C2, m2_iw) /* d,w,x; 2-modifier dyadic 𝕨-inverse; consumes w,x */ \
|
||||
F(D2C2, m2_ix) /* d,w,x; 2-modifier dyadic 𝕩-inverse; consumes w,x */ \
|
||||
\
|
||||
F(B2b, canStore) /* doesn't consume */ \
|
||||
F(u8, elType) /* guarantees that the corresponding i32any_ptr/f64any_ptr/c32any_ptr/… always succeeds */ \
|
||||
@ -665,8 +668,8 @@ static inline B incByG(B x, i64 am) { v(x)->refc+= am; return x; }
|
||||
|
||||
typedef struct Fun {
|
||||
struct Value;
|
||||
BB2B c1;
|
||||
BBB2B c2;
|
||||
FC1 c1;
|
||||
FC2 c2;
|
||||
} Fun;
|
||||
|
||||
#if USE_VALGRIND
|
||||
|
||||
@ -105,11 +105,11 @@ INS B i_FN2O(B w, B f, B x, u32* bc) { POS_UPD;
|
||||
dec(f);
|
||||
return r;
|
||||
}
|
||||
INS B i_FN1Oi(B x, BB2B fm, u32* bc) { POS_UPD;
|
||||
INS B i_FN1Oi(B x, FC1 fm, u32* bc) { POS_UPD;
|
||||
B r = q_N(x)? x : fm(b((u64)0), x);
|
||||
return r;
|
||||
}
|
||||
INS B i_FN2Oi(B w, B x, BB2B fm, BBB2B fd, u32* bc) { POS_UPD;
|
||||
INS B i_FN2Oi(B w, B x, FC1 fm, FC2 fd, u32* bc) { POS_UPD;
|
||||
if (q_N(x)) { dec(w); return x; }
|
||||
else return q_N(w)? fm(b((u64)0), x) : fd(b((u64)0), w, x);
|
||||
}
|
||||
@ -667,8 +667,8 @@ Nvm_res m_nvm(Body* body) {
|
||||
case FN2O: TOPp; GET(R_A1,1,0); GET(R_A2,2,1); IMM(R_A3,off); CCALL(i_FN2O); break; // (B w, B f, B x, u32* bc)
|
||||
case FN1Ci: { u64 fn = L64; POS_UPD(R_A0,R_A3); MOV(R_A1, R_RES); GET(R_A2,0,2); CCALL(fn); } break;
|
||||
case FN2Ci: { u64 fn = L64; POS_UPD(R_A0,R_A3); MOV(R_A1, R_RES); GET(R_A2,1,1); CCALL(fn); } break;
|
||||
case FN1Oi:TOPp; GET(R_A1,0,2); IMM(R_A1,L64); IMM(R_A2,off); CCALL(i_FN1Oi); break; // ( B x, BB2B fm, u32* bc)
|
||||
case FN2Oi:TOPp; GET(R_A1,1,1); IMM(R_A2,L64); IMM(R_A3, L64); IMM(R_A4,off); CCALL(i_FN2Oi); break; // (B w, B x, BB2B fm, BBB2B fd, u32* bc)
|
||||
case FN1Oi:TOPp; GET(R_A1,0,2); IMM(R_A1,L64); IMM(R_A2,off); CCALL(i_FN1Oi); break; // ( B x, FC1 fm, u32* bc)
|
||||
case FN2Oi:TOPp; GET(R_A1,1,1); IMM(R_A2,L64); IMM(R_A3, L64); IMM(R_A4,off); CCALL(i_FN2Oi); break; // (B w, B x, FC1 fm, FC2 fd, u32* bc)
|
||||
case LSTM: case LSTO:; { bool o = *(bc-1) == LSTO;
|
||||
u32 sz = *bc++;
|
||||
if (sz==0 ) { TOPs; CCALL(i_LST_0); } // unused with optimizations
|
||||
|
||||
@ -606,8 +606,8 @@ static B def_m2_d(B m, B f, B g) { thrM("cannot derive this"); }
|
||||
static Arr* def_slice(B x, usz s, usz ia) { thrM("cannot slice non-array!"); }
|
||||
|
||||
B rt_invFnReg, rt_invFnSwap;
|
||||
BB2B rt_invFnRegFn;
|
||||
BB2B rt_invFnSwapFn;
|
||||
FC1 rt_invFnRegFn;
|
||||
FC1 rt_invFnSwapFn;
|
||||
B def_fn_im(B t, B x) { B fn = rt_invFnRegFn(rt_invFnReg, inc(t)); SLOW2("!runtime 𝕎⁼𝕩", t, x); B r = c1(fn, x); dec(fn); return r; }
|
||||
B def_fn_is(B t, B x) { B fn = rt_invFnSwapFn(rt_invFnSwap, inc(t)); SLOW2("!runtime 𝕎⁼𝕩", t, x); B r = c1(fn, x); dec(fn); return r; }
|
||||
B def_fn_iw(B t, B w, B x) { B fn = rt_invFnSwapFn(rt_invFnSwap, inc(t)); SLOW3("!runtime 𝕨F⁼𝕩", w, x, t); B r = c2(fn, w, x); dec(fn); return r; }
|
||||
@ -662,7 +662,7 @@ void def_fallbackTriv(Value* v) { // used while vtables aren't yet fully loaded;
|
||||
TIv(v,freeF)(v);
|
||||
}
|
||||
|
||||
static NOINLINE B m_bfn(BB2B c1, BBB2B c2, u8 id) {
|
||||
static NOINLINE B m_bfn(FC1 c1, FC2 c2, u8 id) {
|
||||
BFn* f = mm_alloc(sizeof(BFn), t_funBI);
|
||||
f->c1 = c1;
|
||||
f->c2 = c2;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
static u32 nfn_curr;
|
||||
static B nfn_list;
|
||||
|
||||
NFnDesc* registerNFn(B name, BB2B c1, BBB2B c2) {
|
||||
NFnDesc* registerNFn(B name, FC1 c1, FC2 c2) {
|
||||
u32 id = nfn_curr++;
|
||||
NFnDesc* r = mm_alloc(sizeof(NFnDesc), t_nfnDesc);
|
||||
r->id = id;
|
||||
|
||||
@ -13,11 +13,11 @@ struct NFnDesc {
|
||||
struct Value;
|
||||
u32 id;
|
||||
B name;
|
||||
BB2B c1;
|
||||
BBB2B c2;
|
||||
FC1 c1;
|
||||
FC2 c2;
|
||||
};
|
||||
|
||||
NFnDesc* registerNFn(B name, BB2B c1, BBB2B c2); // should be called a constant number of times; consumes name
|
||||
NFnDesc* registerNFn(B name, FC1 c1, FC2 c2); // should be called a constant number of times; consumes name
|
||||
B m_nfn(NFnDesc* desc, B obj); // consumes obj
|
||||
B nfn_name(B x); // doesn't consume
|
||||
static void nfn_lateInit(NFn* fn, NFnDesc* desc) {
|
||||
|
||||
@ -76,7 +76,7 @@ u64 fwTotal;
|
||||
B wfn_c1(B t, B x) {
|
||||
WFun* c = c(WFun,t);
|
||||
B f = c->v;
|
||||
BB2B fi = c(Fun,f)->c1;
|
||||
FC1 fi = c(Fun,f)->c1;
|
||||
#if RT_PERF
|
||||
u64 s = nsTime();
|
||||
B r = fi(f, x);
|
||||
@ -103,7 +103,7 @@ B wfn_c1(B t, B x) {
|
||||
B wfn_c2(B t, B w, B x) {
|
||||
WFun* c = c(WFun,t);
|
||||
B f = c->v;
|
||||
BBB2B fi = c(Fun,f)->c2;
|
||||
FC2 fi = c(Fun,f)->c2;
|
||||
#if RT_PERF
|
||||
u64 s = nsTime();
|
||||
B r = fi(f, w, x);
|
||||
|
||||
@ -53,7 +53,7 @@ typedef struct EntAA {
|
||||
|
||||
typedef struct DyTableAA {
|
||||
EntAA entsAA[el_B*el_B]; // one for each instruction
|
||||
BBB2B mainFn;
|
||||
FC2 mainFn;
|
||||
char* repr;
|
||||
} DyTableAA;
|
||||
|
||||
@ -161,7 +161,7 @@ typedef struct {
|
||||
|
||||
struct DyTableSA {
|
||||
EntSA ents[el_B];
|
||||
BBB2B mainFn;
|
||||
FC2 mainFn;
|
||||
char* repr;
|
||||
u8 fill[2][2]; // 0:none 1:int 2:char
|
||||
DyTableSA* chrAtom;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
static inline B mv(B* p, usz n) { B r = p [n]; p [n] = m_f64(0); return r; }
|
||||
static inline B hmv(HArr_p p, usz n) { B r = p.a[n]; p.a[n] = m_f64(0); return r; }
|
||||
|
||||
B eachd_fn(B fo, B w, B x, BBB2B f) {
|
||||
B eachd_fn(B fo, B w, B x, FC2 f) {
|
||||
ur wr, xr; // if rank is 0, respective w/x will be disclosed
|
||||
if (isArr(w)) { wr=RNK(w); if (wr==0) { B c=IGet(w, 0); decG(w); w=c; } } else wr=0;
|
||||
if (isArr(x)) { xr=RNK(x); if (xr==0) { B c=IGet(x, 0); decG(x); x=c; } } else xr=0;
|
||||
@ -56,7 +56,7 @@ B eachd_fn(B fo, B w, B x, BBB2B f) {
|
||||
return rb;
|
||||
}
|
||||
|
||||
B eachm_fn(B fo, B x, BB2B f) {
|
||||
B eachm_fn(B fo, B x, FC1 f) {
|
||||
usz ia = IA(x);
|
||||
usz i = 0;
|
||||
if (ia==0) return x;
|
||||
@ -117,7 +117,7 @@ B eachm_fn(B fo, B x, BB2B f) {
|
||||
}
|
||||
|
||||
#if CATCH_ERRORS
|
||||
B arith_recd(BBB2B f, B w, B x) {
|
||||
B arith_recd(FC2 f, B w, B x) {
|
||||
B fx = getFillQ(x);
|
||||
if (noFill(fx)) return eachd_fn(bi_N, w, x, f);
|
||||
B fw = getFillQ(w);
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
#include "mut.h"
|
||||
|
||||
B eachd_fn(B fo, B w, B x, BBB2B f); // consumes w,x; assumes at least one is array
|
||||
B eachm_fn(B fo, B x, BB2B f); // consumes x; x must be array
|
||||
B eachd_fn(B fo, B w, B x, FC2 f); // consumes w,x; assumes at least one is array
|
||||
B eachm_fn(B fo, B x, FC1 f); // consumes x; x must be array
|
||||
|
||||
|
||||
#if CATCH_ERRORS
|
||||
NOINLINE B arith_recd(BBB2B f, B w, B x);
|
||||
NOINLINE B arith_recd(FC2 f, B w, B x);
|
||||
#else
|
||||
static inline B arith_recd(BBB2B f, B w, B x) { return eachd_fn(bi_N, w, x, f); }
|
||||
static inline B arith_recd(FC2 f, B w, B x) { return eachd_fn(bi_N, w, x, f); }
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user