/src/simdjson/include/simdjson/icelake/bitmask.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef SIMDJSON_ICELAKE_BITMASK_H |
2 | | #define SIMDJSON_ICELAKE_BITMASK_H |
3 | | |
4 | | namespace simdjson { |
5 | | namespace SIMDJSON_IMPLEMENTATION { |
6 | | namespace { |
7 | | |
8 | | // |
9 | | // Perform a "cumulative bitwise xor," flipping bits each time a 1 is encountered. |
10 | | // |
11 | | // For example, prefix_xor(00100100) == 00011100 |
12 | | // |
13 | 0 | simdjson_inline uint64_t prefix_xor(const uint64_t bitmask) { |
14 | | // There should be no such thing with a processor supporting avx2 |
15 | | // but not clmul. |
16 | 0 | __m128i all_ones = _mm_set1_epi8('\xFF'); |
17 | 0 | __m128i result = _mm_clmulepi64_si128(_mm_set_epi64x(0ULL, bitmask), all_ones, 0); |
18 | 0 | return _mm_cvtsi128_si64(result); |
19 | 0 | } Unexecuted instantiation: fuzz_element.cpp:simdjson::icelake::(anonymous namespace)::prefix_xor(unsigned long) Unexecuted instantiation: simdjson.cpp:simdjson::icelake::(anonymous namespace)::prefix_xor(unsigned long) |
20 | | |
21 | | } // unnamed namespace |
22 | | } // namespace SIMDJSON_IMPLEMENTATION |
23 | | } // namespace simdjson |
24 | | |
25 | | #endif // SIMDJSON_ICELAKE_BITMASK_H |