Being systematic about the flattening.

This commit is contained in:
Daniel Lemire
2018-07-26 16:36:35 -04:00
parent 93f4e1d9b4
commit a0c545e2c4
2 changed files with 58 additions and 0 deletions
+14
View File
@@ -296,6 +296,20 @@ never_inline bool flatten_indexes(size_t len, ParsedJson & pj) {
while (s) {
base_ptr[base++] = (u32)idx + __builtin_ctzll(s); s &= s - 1ULL;
}
#elif defined(NO_PDEP_PLEASE)
#ifndef NO_PDEP_WIDTH
#define NO_PDEP_WIDTH 6
#endif
u32 cnt = __builtin_popcountll(s);
u32 next_base = base + cnt;
while (s) {
for(size_t i = 0; i < NO_PDEP_WIDTH; i++) {
base_ptr[base+i] = (u32)idx + __builtin_ctzll(s);
s = s & (s - 1);
}
base += NO_PDEP_WIDTH;
}
base = next_base;
#else
u32 cnt = __builtin_popcountll(s);
u32 next_base = base + cnt;