Skip to content

Commit 0b5d1d0

Browse files
committed
Nest the cnt > 16 branch inside cnt > 8
1 parent 880e892 commit 0b5d1d0

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/generic/stage1_find_marks_flatten.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ really_inline void flatten_bits(uint32_t *&base_ptr, uint32_t idx, uint64_t bits
4848
base_ptr[i] = idx + trailing_zeroes(bits);
4949
bits = bits & (bits - 1);
5050
}
51-
}
5251

53-
// Most files don't have 16+ structurals per block, so we take several basically guaranteed
54-
// branch mispredictions here. 16+ structurals per block means either punctuation ({} [] , :)
55-
// or the start of a value ("abc" true 123) every 4 characters.
56-
if (unlikely(cnt > 16)) {
57-
uint32_t i = 16;
58-
do {
59-
base_ptr[i] = idx + trailing_zeroes(bits);
60-
bits = bits & (bits - 1);
61-
i++;
62-
} while (i < cnt);
52+
// Most files don't have 16+ structurals per block, so we take several basically guaranteed
53+
// branch mispredictions here. 16+ structurals per block means either punctuation ({} [] , :)
54+
// or the start of a value ("abc" true 123) every 4 characters.
55+
if (unlikely(cnt > 16)) {
56+
uint32_t i = 16;
57+
do {
58+
base_ptr[i] = idx + trailing_zeroes(bits);
59+
bits = bits & (bits - 1);
60+
i++;
61+
} while (i < cnt);
62+
}
6363
}
6464

6565
base_ptr += cnt;

src/haswell/stage1_find_marks.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,18 @@ really_inline void flatten_bits(uint32_t *&base_ptr, uint32_t idx, uint64_t bits
112112
base_ptr[i] = idx + trailing_zeroes(bits);
113113
bits = _blsr_u64(bits);
114114
}
115-
}
116115

117-
// Most files don't have 16+ structurals per block, so we take several basically guaranteed
118-
// branch mispredictions here. 16+ structurals per block means either punctuation ({} [] , :)
119-
// or the start of a value ("abc" true 123) every four characters.
120-
if (unlikely(cnt > 16)) {
121-
uint32_t i = 16;
122-
do {
123-
base_ptr[i] = idx + trailing_zeroes(bits);
124-
bits = _blsr_u64(bits);
125-
i++;
126-
} while (i < cnt);
116+
// Most files don't have 16+ structurals per block, so we take several basically guaranteed
117+
// branch mispredictions here. 16+ structurals per block means either punctuation ({} [] , :)
118+
// or the start of a value ("abc" true 123) every four characters.
119+
if (unlikely(cnt > 16)) {
120+
uint32_t i = 16;
121+
do {
122+
base_ptr[i] = idx + trailing_zeroes(bits);
123+
bits = _blsr_u64(bits);
124+
i++;
125+
} while (i < cnt);
126+
}
127127
}
128128

129129
base_ptr += cnt;

0 commit comments

Comments
 (0)