fix function signatures & M1C2; use C1 & bit_negate more
This commit is contained in:
parent
be9037cb62
commit
db89e7a4bb
@ -25,7 +25,6 @@
|
|||||||
#include "../utils/mut.h"
|
#include "../utils/mut.h"
|
||||||
|
|
||||||
extern B ud_c1(B, B);
|
extern B ud_c1(B, B);
|
||||||
extern B not_c1(B, B);
|
|
||||||
extern B ne_c2(B, B, B);
|
extern B ne_c2(B, B, B);
|
||||||
extern B slash_c1(B, B);
|
extern B slash_c1(B, B);
|
||||||
extern B slash_c2(B, B, B);
|
extern B slash_c2(B, B, B);
|
||||||
@ -102,7 +101,7 @@ static B group_simple(B w, B x, ur xr, usz wia, usz xn, usz* xsh, u8 we) {
|
|||||||
assert(ria == 2);
|
assert(ria == 2);
|
||||||
if (wia>xn) w = C2(take, m_f64(xn), w);
|
if (wia>xn) w = C2(take, m_f64(xn), w);
|
||||||
rp[1] = C2(slash, inc(w), inc(x));
|
rp[1] = C2(slash, inc(w), inc(x));
|
||||||
rp[0] = C2(slash, C1(not, w), x);
|
rp[0] = C2(slash, bit_negate(w), x);
|
||||||
return taga(r);
|
return taga(r);
|
||||||
}
|
}
|
||||||
// Needed to make sure wia>0 for ip[wia-1] below
|
// Needed to make sure wia>0 for ip[wia-1] below
|
||||||
|
|||||||
@ -63,7 +63,7 @@ B scan_add_bool(B x, u64 ia) { // consumes x
|
|||||||
B r;
|
B r;
|
||||||
u8 re = xs<=I8_MAX? el_i8 : xs<=I16_MAX? el_i16 : xs<=I32_MAX? el_i32 : el_f64;
|
u8 re = xs<=I8_MAX? el_i8 : xs<=I16_MAX? el_i16 : xs<=I32_MAX? el_i32 : el_f64;
|
||||||
if (xs < ia/128) {
|
if (xs < ia/128) {
|
||||||
B ones = slash_c1(m_f64(0), x);
|
B ones = C1(slash, x);
|
||||||
MAKE_MUT(r0, ia) mut_init(r0, re); MUTG_INIT(r0);
|
MAKE_MUT(r0, ia) mut_init(r0, re); MUTG_INIT(r0);
|
||||||
SGetU(ones)
|
SGetU(ones)
|
||||||
usz ri = 0;
|
usz ri = 0;
|
||||||
@ -112,8 +112,8 @@ B scan_add_bool(B x, u64 ia) { // consumes x
|
|||||||
MM_CASE(f64,NAME,C,F64_##INIT) \
|
MM_CASE(f64,NAME,C,F64_##INIT) \
|
||||||
} \
|
} \
|
||||||
decG(x); return FL_SET(r, fl_##ORD);
|
decG(x); return FL_SET(r, fl_##ORD);
|
||||||
B scan_min_num(B x, u8 xe, usz ia) { MINMAX(min,<,MAX,and,dsc) }
|
B scan_min_num(B x, u8 xe, u64 ia) { MINMAX(min,<,MAX,and,dsc) }
|
||||||
B scan_max_num(B x, u8 xe, usz ia) { MINMAX(max,>,MIN,or ,asc) }
|
B scan_max_num(B x, u8 xe, u64 ia) { MINMAX(max,>,MIN,or ,asc) }
|
||||||
#undef MINMAX
|
#undef MINMAX
|
||||||
// Initialized: try to convert 𝕨 to type of 𝕩
|
// Initialized: try to convert 𝕨 to type of 𝕩
|
||||||
// (could do better for out-of-range floats)
|
// (could do better for out-of-range floats)
|
||||||
|
|||||||
@ -35,7 +35,6 @@
|
|||||||
#include "../utils/calls.h"
|
#include "../utils/calls.h"
|
||||||
#include "../builtins.h"
|
#include "../builtins.h"
|
||||||
|
|
||||||
extern B not_c1(B, B);
|
|
||||||
extern B shape_c1(B, B);
|
extern B shape_c1(B, B);
|
||||||
extern B slash_c2(B, B, B);
|
extern B slash_c2(B, B, B);
|
||||||
extern B ud_c1(B, B);
|
extern B ud_c1(B, B);
|
||||||
@ -416,7 +415,7 @@ B indexOf_c1(B t, B x) {
|
|||||||
u8 lw = cellWidthLog(x);
|
u8 lw = cellWidthLog(x);
|
||||||
void* xv = tyany_ptr(x);
|
void* xv = tyany_ptr(x);
|
||||||
if (lw == 0) {
|
if (lw == 0) {
|
||||||
B r = 1&*(u64*)xv ? C1(not, x) : x;
|
B r = 1&*(u64*)xv ? bit_negate(x) : x;
|
||||||
return C1(shape, r);
|
return C1(shape, r);
|
||||||
}
|
}
|
||||||
if (use_sorted(x, lw) && n>8) {
|
if (use_sorted(x, lw) && n>8) {
|
||||||
|
|||||||
@ -413,7 +413,6 @@ static NOINLINE B zeroCells(B x) { // doesn't consume
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
B not_c1(B t, B x);
|
|
||||||
B grade_bool(B x, usz xia, bool up) {
|
B grade_bool(B x, usz xia, bool up) {
|
||||||
#define BRANCHLESS_GRADE(T) \
|
#define BRANCHLESS_GRADE(T) \
|
||||||
T* rp; r = m_##T##arrv(&rp, xia); \
|
T* rp; r = m_##T##arrv(&rp, xia); \
|
||||||
@ -433,7 +432,7 @@ B grade_bool(B x, usz xia, bool up) {
|
|||||||
#if SINGELI && defined(__BMI2__)
|
#if SINGELI && defined(__BMI2__)
|
||||||
if (xia < 16) { BRANCHLESS_GRADE(i8) }
|
if (xia < 16) { BRANCHLESS_GRADE(i8) }
|
||||||
else if (xia <= 1<<15) {
|
else if (xia <= 1<<15) {
|
||||||
B notx = not_c1(m_f64(0), inc(x));
|
B notx = bit_negate(inc(x));
|
||||||
u64* xp0 = bitarr_ptr(notx);
|
u64* xp0 = bitarr_ptr(notx);
|
||||||
u64* xp1 = xp;
|
u64* xp1 = xp;
|
||||||
if (!up) { u64* t=xp1; xp1=xp0; xp0=t; }
|
if (!up) { u64* t=xp1; xp1=xp0; xp0=t; }
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
#define C1(F,X ) F##_c1(m_f64(0),X )
|
#define C1(F,X ) F##_c1(m_f64(0),X )
|
||||||
#define C2(F,X,W) F##_c2(m_f64(0),X,W)
|
#define C2(F,X,W) F##_c2(m_f64(0),X,W)
|
||||||
#define M1C1(M,F, X) m1c1_unsafe(M##_c1, bi_##F, X)
|
#define M1C1(M,F, X) m1c1_unsafe(M##_c1, bi_##F, X)
|
||||||
#define M1C2(M,F,X,W) m1c2_unsafe(M##_c1, bi_##F, X, W)
|
#define M1C2(M,F,W,X) m1c2_unsafe(M##_c2, bi_##F, W, X)
|
||||||
static inline B m1c1_unsafe(D1C1 m, B f, B x) { Md1D d; d.f=f; return m(&d, x); }
|
static inline B m1c1_unsafe(D1C1 m, B f, B x) { Md1D d; d.f=f; return m(&d, x); }
|
||||||
static inline B m1c2_unsafe(D1C2 m, B f, B x, B w) { Md1D d; d.f=f; return m(&d, x, w); }
|
static inline B m1c2_unsafe(D1C2 m, B f, B w, B x) { Md1D d; d.f=f; return m(&d, w, x); }
|
||||||
|
|
||||||
typedef void (*M_CopyF)(void*, usz, B, usz, usz);
|
typedef void (*M_CopyF)(void*, usz, B, usz, usz);
|
||||||
typedef void (*M_FillF)(void*, usz, B, usz);
|
typedef void (*M_FillF)(void*, usz, B, usz);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user