@@ -53,6 +53,7 @@ really_inline void find_whitespace_and_structurals(simd_input<ARCHITECTURE> in,
5353 space = _mm256_or_si256 (space, _mm256_cmpeq_epi8 (in, mask_linefeed));
5454 space = _mm256_or_si256 (space, _mm256_cmpeq_epi8 (in, mask_tab));
5555 space = _mm256_or_si256 (space, _mm256_cmpeq_epi8 (in, mask_carriage));
56+ return space;
5657 }).to_bitmask ();
5758 // end of naive approach
5859
@@ -69,15 +70,14 @@ really_inline void find_whitespace_and_structurals(simd_input<ARCHITECTURE> in,
6970 const __m256i struct_offset = _mm256_set1_epi8 (0xd4u );
7071 const __m256i struct_mask = _mm256_set1_epi8 (32 );
7172
72- whitespace = in.map ([&](auto chunk) {
73- return _mm256_cmpeq_epi8 (chunk, _mm256_shuffle_epi8 (white_table, chunk));
74- }).to_bitmask ();
75- structurals = in.map ([&](auto chunk) {
76- __m256i struct_r1 = _mm256_add_epi8 (struct_offset, chunk);
77- __m256i struct_r2 = _mm256_or_si256 (chunk, struct_mask);
78- __m256i struct_r3 = _mm256_shuffle_epi8 (structural_table, struct_r1);
79- return _mm256_cmpeq_epi8 (struct_r2, struct_r3);
80- }).to_bitmask ();
73+ whitespace = in.MAP_BITMASK ( _mm256_cmpeq_epi8 (chunk, _mm256_shuffle_epi8 (white_table, chunk)) );
74+ auto struct_r1 = in.MAP_CHUNKS ( _mm256_add_epi8 (struct_offset, chunk) );
75+ auto struct_r2 = in.MAP_CHUNKS ( _mm256_or_si256 (chunk, struct_mask) );
76+ auto struct_r3 = struct_r1.MAP_CHUNKS ( _mm256_shuffle_epi8 (structural_table, chunk) );
77+ structurals = simd_input<ARCHITECTURE>(
78+ _mm256_cmpeq_epi8 (struct_r2.lo , struct_r3.lo ),
79+ _mm256_cmpeq_epi8 (struct_r2.hi , struct_r3.hi )
80+ ).to_bitmask ();
8181
8282 #endif // else SIMDJSON_NAIVE_STRUCTURAL
8383}
0 commit comments