@@ -84,56 +84,6 @@ really_inline void find_whitespace_and_operators(
8484 #endif // else SIMDJSON_NAIVE_STRUCTURAL
8585}
8686
87- class bit_indexer {
88- public:
89- uint32_t *tail;
90-
91- bit_indexer (uint32_t *index_buf) : tail(index_buf) {}
92-
93- // flatten out values in 'bits' assuming that they are are to have values of idx
94- // plus their position in the bitvector, and store these indexes at
95- // base_ptr[base] incrementing base as we go
96- // will potentially store extra values beyond end of valid bits, so base_ptr
97- // needs to be large enough to handle this
98- really_inline void write_indexes (uint32_t idx, uint64_t bits) {
99- // In some instances, the next branch is expensive because it is mispredicted.
100- // Unfortunately, in other cases,
101- // it helps tremendously.
102- if (bits == 0 )
103- return ;
104- uint32_t cnt = _mm_popcnt_u64 (bits);
105-
106- // Do the first 8 all together
107- for (int i=0 ; i<8 ; i++) {
108- this ->tail [i] = idx + trailing_zeroes (bits);
109- bits = _blsr_u64 (bits);
110- }
111-
112- // Do the next 8 all together (we hope in most cases it won't happen at all
113- // and the branch is easily predicted).
114- if (unlikely (cnt > 8 )) {
115- for (int i=8 ; i<16 ; i++) {
116- this ->tail [i] = idx + trailing_zeroes (bits);
117- bits = _blsr_u64 (bits);
118- }
119-
120- // Most files don't have 16+ structurals per block, so we take several basically guaranteed
121- // branch mispredictions here. 16+ structurals per block means either punctuation ({} [] , :)
122- // or the start of a value ("abc" true 123) every four characters.
123- if (unlikely (cnt > 16 )) {
124- uint32_t i = 16 ;
125- do {
126- this ->tail [i] = idx + trailing_zeroes (bits);
127- bits = _blsr_u64 (bits);
128- i++;
129- } while (i < cnt);
130- }
131- }
132-
133- this ->tail += cnt;
134- }
135- };
136-
13787#include " generic/stage1_find_marks.h"
13888
13989} // namespace haswell
0 commit comments