restore usage of bitarr_ptr where appropriate
This commit is contained in:
parent
5098781ffc
commit
37a3694df7
@ -293,7 +293,7 @@ static void set_column_typed(void* rp, B v, u8 e, ux p, ux stride, ux n) { // ma
|
||||
bit_special:;
|
||||
bool b = o2bG(v);
|
||||
B m1 = taga(arr_shVec(b? allZeroes(stride) : allOnes(stride)));
|
||||
bitp_set(bitany_ptr(m1), p, b);
|
||||
bitp_set(bitarr_ptr(m1), p, b);
|
||||
B m = C2(shape, m_f64(stride*n+8), m1); // +8 to make the following loops reading past-the-end read acceptable values
|
||||
assert(TI(m,elType)==el_bit);
|
||||
u8* mp = (u8*)bitany_ptr(m);
|
||||
|
||||
@ -218,7 +218,7 @@ static B group_simple(B w, B x, ur xr, usz wia, usz xn, usz* xsh, u8 we) {
|
||||
allocBitGroups(rp, ria, z, xr, xsh, len, width);
|
||||
for (usz i = 0; i < xn; i++) {
|
||||
bool b = bitp_get(xp,i); i32 n = wp[i];
|
||||
if (n>=0) bitp_set(bitany_ptr(rp[n]), pos[n]++, b);
|
||||
if (n>=0) bitp_set(bitarr_ptr(rp[n]), pos[n]++, b);
|
||||
}
|
||||
} else { // Generic case
|
||||
for (usz i = 0; i < ria; i++) {
|
||||
|
||||
@ -308,7 +308,7 @@ B internalTemp_c1(B t, B x) {
|
||||
#endif
|
||||
#ifdef TEST_BITCPY
|
||||
SGetU(x)
|
||||
bit_cpyN(bitany_ptr(GetU(x,0)), o2s(GetU(x,1)), bitany_ptr(GetU(x,2)), o2s(GetU(x,3)), o2s(GetU(x,4)));
|
||||
bit_cpyN(bitarr_ptr(GetU(x,0)), o2s(GetU(x,1)), bitany_ptr(GetU(x,2)), o2s(GetU(x,3)), o2s(GetU(x,4)));
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -261,9 +261,9 @@ B scan_c1(Md1D* d, B x) { B f = d->f;
|
||||
case n_eq: return scan_eq(x, ia); // =
|
||||
case n_lt: return scan_lt(x, 0, ia); // <
|
||||
case n_le: return bit_negate(scan_lt(bit_negate(x), 0, ia)); // ≤
|
||||
case n_gt: x=bit_negate(x); *bitany_ptr(x)^= 1; return scan_and(x, ia); // >
|
||||
case n_ge: x=bit_negate(x); *bitany_ptr(x)^= 1; return scan_or (x, ia); // ≥
|
||||
case n_sub: return C2(sub, m_f64(2 * (*bitany_ptr(x) & 1)), scan_add_bool(x, ia)); // -
|
||||
case n_gt: x=bit_negate(x); *bitarr_ptr(x)^= 1; return scan_and(x, ia); // >
|
||||
case n_ge: x=bit_negate(x); *bitarr_ptr(x)^= 1; return scan_or (x, ia); // ≥
|
||||
case n_sub: return C2(sub, m_f64(2 * (*bitarr_ptr(x) & 1)), scan_add_bool(x, ia)); // -
|
||||
}
|
||||
if (rtid==n_add) return scan_plus(0, x, xe, ia); // +
|
||||
if (rtid==n_floor) return scan_min_num(x, xe, ia); // ⌊
|
||||
|
||||
@ -362,7 +362,7 @@ B grade_bool(B x, usz xia, bool up) {
|
||||
if (xia < 16) { BRANCHLESS_GRADE(i8) }
|
||||
else if (xia <= 1<<15) {
|
||||
B notx = bit_negate(incG(x));
|
||||
u64* xp0 = bitany_ptr(notx);
|
||||
u64* xp0 = bitarr_ptr(notx);
|
||||
u64* xp1 = xp;
|
||||
u64 q=xia%64; if (q) { usz e=xia/64; u64 m=((u64)1<<q)-1; xp0[e]&=m; xp1[e]&=m; }
|
||||
if (!up) { u64* t=xp1; xp1=xp0; xp0=t; }
|
||||
|
||||
@ -75,7 +75,7 @@ NOINLINE B m_c32vec_0(u32* s) { usz sz=0; while(s[sz]) sz++; return m_c32vec(s,
|
||||
|
||||
static Arr* bitarr_slice(B x, usz s, usz ia) {
|
||||
u64* rp; Arr* r = m_bitarrp(&rp, ia);
|
||||
bit_cpy(rp, 0, bitany_ptr(x), s, ia);
|
||||
bit_cpy(rp, 0, bitarr_ptr(x), s, ia);
|
||||
ptr_dec(v(x));
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ static inline bool inplace_add(B w, B x) { // consumes x if returns true; fails
|
||||
u64 wsz = mm_sizeUsable(v(w));
|
||||
u8 wt = TY(w);
|
||||
switch (wt) {
|
||||
case t_bitarr: if (BITARR_SZ( ria)<wsz && q_bit(x)) { bitp_set(bitany_ptr(w),wia,o2bG(x)); goto ok; } break;
|
||||
case t_bitarr: if (BITARR_SZ( ria)<wsz && q_bit(x)) { bitp_set(bitarr_ptr(w),wia,o2bG(x)); goto ok; } break;
|
||||
case t_i8arr: if (TYARR_SZ(I8, ria)<wsz && q_i8 (x)) { i8arr_ptr (w)[wia]=o2iG(x); goto ok; } break;
|
||||
case t_i16arr: if (TYARR_SZ(I16,ria)<wsz && q_i16(x)) { i16arr_ptr(w)[wia]=o2iG(x); goto ok; } break;
|
||||
case t_i32arr: if (TYARR_SZ(I32,ria)<wsz && q_i32(x)) { i32arr_ptr(w)[wia]=o2iG(x); goto ok; } break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user