simdjson  3.11.0
Ridiculously Fast JSON
bitmask.h
1 #ifndef SIMDJSON_LSX_BITMASK_H
2 #define SIMDJSON_LSX_BITMASK_H
3 
4 #ifndef SIMDJSON_CONDITIONAL_INCLUDE
5 #include "simdjson/lsx/base.h"
6 #endif // SIMDJSON_CONDITIONAL_INCLUDE
7 
8 namespace simdjson {
9 namespace lsx {
10 namespace {
11 
12 //
13 // Perform a "cumulative bitwise xor," flipping bits each time a 1 is encountered.
14 //
15 // For example, prefix_xor(00100100) == 00011100
16 //
17 simdjson_inline uint64_t prefix_xor(uint64_t bitmask) {
18  bitmask ^= bitmask << 1;
19  bitmask ^= bitmask << 2;
20  bitmask ^= bitmask << 4;
21  bitmask ^= bitmask << 8;
22  bitmask ^= bitmask << 16;
23  bitmask ^= bitmask << 32;
24  return bitmask;
25 }
26 
27 } // unnamed namespace
28 } // namespace lsx
29 } // namespace simdjson
30 
31 #endif
The top level simdjson namespace, containing everything the library provides.
Definition: base.h:8