don't not check top bits in LIKELY & RARE
This commit is contained in:
parent
889c520251
commit
89503ba1c1
@ -115,8 +115,8 @@
|
||||
|
||||
// Sparse Where with branching
|
||||
#define WHERE_SPARSE(X,R,S,I0,COND) do { \
|
||||
for (usz ii=I0, j=0; j<S; ii++) \
|
||||
for (u64 v=(X)[ii]; COND(v); v&=v-1) R[j++] = ii*64 + CTZ(v); \
|
||||
for (usz ii=I0, j=0; j<S; ii++) \
|
||||
for (u64 v=(X)[ii]; COND(v!=0); v&=v-1) R[j++] = ii*64 + CTZ(v); \
|
||||
} while (0)
|
||||
|
||||
// Branchless sparse Where (bsp)
|
||||
|
||||
4
src/h.h
4
src/h.h
@ -132,8 +132,8 @@ typedef double f64;
|
||||
#define CLZ(X) __builtin_clzll(X)
|
||||
#define CTZ(X) __builtin_ctzll(X)
|
||||
#define POPC(X) __builtin_popcountll(X)
|
||||
#define LIKELY(X) __builtin_expect(X,1)
|
||||
#define RARE(X) __builtin_expect(X,0)
|
||||
#define LIKELY(X) __builtin_expect((X)!=0,1)
|
||||
#define RARE(X) __builtin_expect((X)!=0,0)
|
||||
#define fsizeof(T,F,E,N) (offsetof(T, F) + sizeof(E)*(N)) // type, flexible array member name, flexible array member type, item amount
|
||||
#define RFLD(X,T,F) ((T*)((char*)(X) - offsetof(T,F))) // value, result type, field name; reverse-read field: `T* x = …; E v = x->f; x == RFLD(v, T, f)`
|
||||
#define N64x "%"SCNx64
|
||||
|
||||
Loading…
Reference in New Issue
Block a user