unified int & char cases for ⊔
This commit is contained in:
parent
7f9773f971
commit
7ece6b2179
@ -975,26 +975,20 @@ B group_c2(B t, B w, B x) {
|
|||||||
|
|
||||||
Arr* rf = m_fillarrp(0); fillarr_setFill(rf, m_f64(0)); arr_shVec(rf);
|
Arr* rf = m_fillarrp(0); fillarr_setFill(rf, m_f64(0)); arr_shVec(rf);
|
||||||
fillarr_setFill(r, taga(rf));
|
fillarr_setFill(r, taga(rf));
|
||||||
if (TI(x,elType)==el_i8) {
|
u8 xe = TI(x,elType);
|
||||||
for (usz i = 0; i < ria; i++) { i8* t; rp[i] = m_i8arrv(&t, len[i]); }
|
if (xe==el_i8 || xe==el_c8) {
|
||||||
i8* xp = i8any_ptr(x);
|
for (usz i = 0; i < ria; i++) m_tyarrv(rp+i, 1, len[i], el2t(xe));
|
||||||
|
u8* xp = tyany_ptr(x);
|
||||||
for (usz i = 0; i < xia; i++) {
|
for (usz i = 0; i < xia; i++) {
|
||||||
i32 n = wp[i];
|
i32 n = wp[i];
|
||||||
if (n>=0) i8arr_ptr(rp[n])[pos[n]++] = xp[i];
|
if (n>=0) ((u8*)tyarr_ptr(rp[n]))[pos[n]++] = xp[i];
|
||||||
}
|
}
|
||||||
} else if (TI(x,elType)==el_i32) {
|
} else if (xe==el_i32 || xe==el_c32) {
|
||||||
for (usz i = 0; i < ria; i++) { i32* t; rp[i] = m_i32arrv(&t, len[i]); }
|
for (usz i = 0; i < ria; i++) m_tyarrv(rp+i, 4, len[i], el2t(xe));
|
||||||
i32* xp = i32any_ptr(x);
|
u32* xp = tyany_ptr(x);
|
||||||
for (usz i = 0; i < xia; i++) {
|
for (usz i = 0; i < xia; i++) {
|
||||||
i32 n = wp[i];
|
i32 n = wp[i];
|
||||||
if (n>=0) i32arr_ptr(rp[n])[pos[n]++] = xp[i];
|
if (n>=0) ((u32*)tyarr_ptr(rp[n]))[pos[n]++] = xp[i];
|
||||||
}
|
|
||||||
} else if (TI(x,elType)==el_c32) {
|
|
||||||
for (usz i = 0; i < ria; i++) { u32* t; rp[i] = m_c32arrv(&t, len[i]); }
|
|
||||||
u32* xp = c32any_ptr(x);
|
|
||||||
for (usz i = 0; i < xia; i++) {
|
|
||||||
i32 n = wp[i];
|
|
||||||
if (n>=0) c32arr_ptr(rp[n])[pos[n]++] = xp[i];
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (usz i = 0; i < ria; i++) {
|
for (usz i = 0; i < ria; i++) {
|
||||||
|
|||||||
@ -14,6 +14,7 @@ static B* arrV_bptr(Arr* x) {
|
|||||||
if (x->type==t_fillslice) return ((FillSlice*)x)->a;
|
if (x->type==t_fillslice) return ((FillSlice*)x)->a;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
static void* tyarr_ptr(B x) { return c(TyArr,x)->a; }
|
||||||
static void* tyany_ptr(B x) {
|
static void* tyany_ptr(B x) {
|
||||||
u8 t = v(x)->type;
|
u8 t = v(x)->type;
|
||||||
return IS_SLICE(t)? c(TySlice,x)->a : c(TyArr,x)->a;
|
return IS_SLICE(t)? c(TySlice,x)->a : c(TyArr,x)->a;
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
⟨LV⇐ListVariations, V⇐Variation, I⇐Info, TY⇐Type, Refc⇐Refc⟩ ← •internal
|
⟨LV⇐ListVariations, V⇐Variation, ClearRefs⇐ClearRefs, I⇐Info, TY⇐Type, Refc⇐Refc, EEQ⇐EEqual⟩ ← •internal
|
||||||
u ← ⌊100×(•UnixTime+1|100וMonoTime)@
|
u ← ⌊100×(•UnixTime+1|100וMonoTime)@
|
||||||
|
|
||||||
rand ← •MakeRand •Show u
|
rand ← •MakeRand •Show u
|
||||||
|
⟨RandVals⟩ ← ⟨rand⟩ •Import "utils.bqn"
|
||||||
R ← rand.Range
|
R ← rand.Range
|
||||||
RB ← "Ab" V R⟜2 # uniformly random boolean array
|
RB ← "Ab" V R⟜2 # uniformly random boolean array
|
||||||
RB2 ← {¬⍟(R 2) "Ab" V 𝕩 R 1+R 2⋆R 10} # random boolean array with random uniform probability
|
RB2 ← {¬⍟(R 2) "Ab" V 𝕩 R 1+R 2⋆R 10} # random boolean array with random uniform probability
|
||||||
@ -38,10 +39,35 @@ BitSlash ← {ty‿dy‿max𝕊n:
|
|||||||
}¨↕n
|
}¨↕n
|
||||||
}
|
}
|
||||||
|
|
||||||
•Show "∨`bitarr" ⋄ OrScanBitarr 100000
|
_testConsistent ← { w0 F _𝕣 x0:
|
||||||
•Show "+`bitarr" ⋄ PlusScanBitarr 100000
|
∧´ (⊏ EEQ¨1↓⊢) ⥊𝕨 {(𝕨 V w0) F (𝕩 V x0)}⌜○LV 𝕩? ClearRefs@;
|
||||||
|
|
||||||
|
w0 F _𝕣 x0:
|
||||||
|
•Out "Fail for:"
|
||||||
|
"𝕨: "‿"𝕩: " •Out∘(∾⟜•Repr)¨ 𝕨⋈𝕩
|
||||||
|
tbl ← 𝕨 {(𝕨 V w0) F (𝕩 V x0)}⌜○LV 𝕩
|
||||||
|
•Show (<∘⊑≡¨⊢) tbl
|
||||||
|
•Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
•Show "heap corruption of /bit" ⋄ @‿0‿200 BitSlash 1000000
|
Group ← {𝕊:
|
||||||
•Show "heap corruption of bit/i8" ⋄ "Ai8"‿1‿50 BitSlash 1000000
|
t ← R 8
|
||||||
•Show "heap corruption of bit/i16" ⋄ "Ai16"‿1‿50 BitSlash 1000000
|
l ← R 10
|
||||||
•Show "heap corruption of bit/i32" ⋄ "Ai32"‿1‿50 BitSlash 1000000
|
x ← l RandVals t
|
||||||
|
w ← ¯1+l R 1+l
|
||||||
|
w ⊔_testConsistent x
|
||||||
|
1
|
||||||
|
}¨ ↕
|
||||||
|
|
||||||
|
# •Show "∨`bitarr" ⋄ OrScanBitarr 100000
|
||||||
|
# •Show "+`bitarr" ⋄ PlusScanBitarr 100000
|
||||||
|
|
||||||
|
# •Show "heap corruption of /bit" ⋄ @‿0‿200 BitSlash 1000000
|
||||||
|
# •Show "heap corruption of bit/i8" ⋄ "Ai8"‿1‿50 BitSlash 1000000
|
||||||
|
# •Show "heap corruption of bit/i16" ⋄ "Ai16"‿1‿50 BitSlash 1000000
|
||||||
|
# •Show "heap corruption of bit/i32" ⋄ "Ai32"‿1‿50 BitSlash 1000000
|
||||||
|
|
||||||
|
{
|
||||||
|
¬0 EEQ -0? •Out "Skipping tests requiring EEQUAL_NEGZERO";
|
||||||
|
•Show "⊔ consistency" ⋄ Group 10000
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user