i8 ∊, typed ≢ & ≍
This commit is contained in:
parent
23f2f4303b
commit
28566f5c9c
@ -96,24 +96,20 @@ B rtack_c1(B t, B x) { return x; }
|
||||
B rtack_c2(B t, B w, B x) { dec(w); return x; }
|
||||
|
||||
B fne_c1(B t, B x) {
|
||||
if (isArr(x)) {
|
||||
ur xr = rnk(x);
|
||||
usz* sh = a(x)->sh;
|
||||
for (i32 i = 0; i < xr; i++) if (sh[i]>I32_MAX) {
|
||||
f64* rp; B r = m_f64arrv(&rp, xr);
|
||||
for (i32 j = 0; j < xr; j++) rp[j] = sh[j];
|
||||
dec(x);
|
||||
return r;
|
||||
}
|
||||
i32* rp;
|
||||
B r = m_i32arrv(&rp, xr);
|
||||
for (i32 i = 0; i < xr; i++) rp[i] = sh[i];
|
||||
dec(x);
|
||||
return r;
|
||||
} else {
|
||||
if (isAtm(x)) {
|
||||
dec(x);
|
||||
return emptyIVec();
|
||||
}
|
||||
ur xr = rnk(x);
|
||||
usz* sh = a(x)->sh;
|
||||
usz or = 0;
|
||||
for (i32 i = 0; i < xr; i++) or|= sh[i];
|
||||
B r;
|
||||
if (or<=I8_MAX ) { i8* rp; r = m_i8arrv (&rp, xr); for (i32 i = 0; i < xr; i++) rp[i] = sh[i]; }
|
||||
else if (or<=I16_MAX) { i16* rp; r = m_i16arrv(&rp, xr); for (i32 i = 0; i < xr; i++) rp[i] = sh[i]; }
|
||||
else if (or<=I32_MAX) { i32* rp; r = m_i32arrv(&rp, xr); for (i32 i = 0; i < xr; i++) rp[i] = sh[i]; }
|
||||
else { f64* rp; r = m_f64arrv(&rp, xr); for (i32 i = 0; i < xr; i++) rp[i] = sh[i]; }
|
||||
dec(x); return r;
|
||||
}
|
||||
B feq_c1(B t, B x) {
|
||||
u64 r = depth(x);
|
||||
@ -251,7 +247,7 @@ B memberOf_c1(B t, B x) {
|
||||
if (rnk(x)!=1) x = toCells(x);
|
||||
usz xia = a(x)->ia;
|
||||
|
||||
i32* rp; B r = m_i32arrv(&rp, xia);
|
||||
i8* rp; B r = m_i8arrv(&rp, xia);
|
||||
H_Sb* set = m_Sb(64);
|
||||
SGetU(x)
|
||||
for (usz i = 0; i < xia; i++) rp[i] = !ins_Sb(&set, GetU(x,i));
|
||||
@ -268,7 +264,7 @@ B memberOf_c2(B t, B w, B x) {
|
||||
SGetU(x)
|
||||
SGetU(w)
|
||||
for (usz i = 0; i < xia; i++) mk_Sb(&set, GetU(x,i), &had);
|
||||
i32* rp; B r = m_i32arrv(&rp, wia);
|
||||
i8* rp; B r = m_i8arrv(&rp, wia);
|
||||
for (usz i = 0; i < wia; i++) rp[i] = has_Sb(set, GetU(w,i));
|
||||
free_Sb(set); dec(w);dec(x);
|
||||
return r;
|
||||
|
||||
@ -634,26 +634,24 @@ B join_c2(B t, B w, B x) {
|
||||
|
||||
|
||||
B couple_c1(B t, B x) {
|
||||
if (isArr(x)) {
|
||||
usz rr = rnk(x);
|
||||
usz ia = a(x)->ia;
|
||||
Arr* r = TI(x,slice)(inc(x),0, ia);
|
||||
usz* sh = arr_shAlloc(r, rr+1);
|
||||
if (sh) { sh[0] = 1; memcpy(sh+1, a(x)->sh, rr*sizeof(usz)); }
|
||||
dec(x);
|
||||
return taga(r);
|
||||
}
|
||||
if (q_i32(x)) { i32* rp; B r = m_i32arrv(&rp, 1); rp[0] = o2iu(x); return r; }
|
||||
if (isF64(x)) { f64* rp; B r = m_f64arrv(&rp, 1); rp[0] = o2fu(x); return r; }
|
||||
if (isC32(x)) { u32* rp; B r = m_c32arrv(&rp, 1); rp[0] = o2cu(x); return r; }
|
||||
HArr_p r = m_harrUv(1);
|
||||
r.a[0] = x;
|
||||
return r.b;
|
||||
if (isAtm(x)) return unitV1(x);
|
||||
usz rr = rnk(x);
|
||||
usz ia = a(x)->ia;
|
||||
Arr* r = TI(x,slice)(inc(x),0, ia);
|
||||
usz* sh = arr_shAlloc(r, rr+1);
|
||||
if (sh) { sh[0] = 1; memcpy(sh+1, a(x)->sh, rr*sizeof(usz)); }
|
||||
dec(x);
|
||||
return taga(r);
|
||||
}
|
||||
B couple_c2(B t, B w, B x) {
|
||||
if (isAtm(w)&isAtm(x)) {
|
||||
if (q_i32(x)&q_i32(w)) { i32* rp; B r = m_i32arrv(&rp, 2); rp[0]=o2iu(w); rp[1]=o2iu(x); return r; }
|
||||
if (isF64(x)&isF64(w)) { f64* rp; B r = m_f64arrv(&rp, 2); rp[0]=o2fu(w); rp[1]=o2fu(x); return r; }
|
||||
if (LIKELY(isNum(w)&isNum(x))) {
|
||||
i32 wi=w.f; i32 xi=x.f;
|
||||
if (RARE(wi!=w.f | xi!=x.f)) { f64* rp; B r = m_f64arrv(&rp, 2); rp[0]=o2fu(w); rp[1]=o2fu(x); return r; }
|
||||
else if (wi==(i8 )wi & xi==(i8 )xi) { i8* rp; B r = m_i8arrv (&rp, 2); rp[0]=o2iu(w); rp[1]=o2iu(x); return r; }
|
||||
else if (wi==(i16)wi & xi==(i16)xi) { i16* rp; B r = m_i16arrv(&rp, 2); rp[0]=o2iu(w); rp[1]=o2iu(x); return r; }
|
||||
else { i32* rp; B r = m_i32arrv(&rp, 2); rp[0]=o2iu(w); rp[1]=o2iu(x); return r; }
|
||||
}
|
||||
if (isC32(x)&isC32(w)) { u32* rp; B r = m_c32arrv(&rp, 2); rp[0]=o2cu(w); rp[1]=o2cu(x); return r; }
|
||||
}
|
||||
if (isAtm(w)) w = m_atomUnit(w);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user