13 0, 1, 1, 2, 1, 2, 2, 3,
14 1, 2, 2, 3, 2, 3, 3, 4,
15 1, 2, 2, 3, 2, 3, 3, 4,
16 2, 3, 3, 4, 3, 4, 4, 5,
17 1, 2, 2, 3, 2, 3, 3, 4,
18 2, 3, 3, 4, 3, 4, 4, 5,
19 2, 3, 3, 4, 3, 4, 4, 5,
20 3, 4, 4, 5, 4, 5, 5, 6,
21 1, 2, 2, 3, 2, 3, 3, 4,
22 2, 3, 3, 4, 3, 4, 4, 5,
23 2, 3, 3, 4, 3, 4, 4, 5,
24 3, 4, 4, 5, 4, 5, 5, 6,
25 2, 3, 3, 4, 3, 4, 4, 5,
26 3, 4, 4, 5, 4, 5, 5, 6,
27 3, 4, 4, 5, 4, 5, 5, 6,
28 4, 5, 5, 6, 5, 6, 6, 7,
29 1, 2, 2, 3, 2, 3, 3, 4,
30 2, 3, 3, 4, 3, 4, 4, 5,
31 2, 3, 3, 4, 3, 4, 4, 5,
32 3, 4, 4, 5, 4, 5, 5, 6,
33 2, 3, 3, 4, 3, 4, 4, 5,
34 3, 4, 4, 5, 4, 5, 5, 6,
35 3, 4, 4, 5, 4, 5, 5, 6,
36 4, 5, 5, 6, 5, 6, 6, 7,
37 2, 3, 3, 4, 3, 4, 4, 5,
38 3, 4, 4, 5, 4, 5, 5, 6,
39 3, 4, 4, 5, 4, 5, 5, 6,
40 4, 5, 5, 6, 5, 6, 6, 7,
41 3, 4, 4, 5, 4, 5, 5, 6,
42 4, 5, 5, 6, 5, 6, 6, 7,
43 4, 5, 5, 6, 5, 6, 6, 7,
44 5, 6, 6, 7, 6, 7, 7, 8
51 inline constexpr uint8_t
rank1(uint8_t v) {
59 inline constexpr uint8_t
rank1(uint16_t v) {
60 return __builtin_popcount(v);
67 inline constexpr uint8_t
rank1(uint32_t v) {
68 return __builtin_popcount(v);
75 inline constexpr uint8_t
rank1(uint64_t v) {
76 return __builtin_popcountll(v);
89 template<
typename u
int_t>
108 template<
typename u
int_t>
112 l <= m) <<
"l=" << l <<
",m=" << m;
117 std::numeric_limits<uint_t>::max() << l;
121 template<
typename u
int_t>
126 template<
typename u
int_t>
128 return (m + 1) -
rank1(v, m);
131 template<
typename u
int_t>
133 return (m - l + 1) -
rank1(v, l, m);
Contains the text compression and encoding framework.
Yields the position of the most significant bit for the template integer type.
constexpr uint8_t rank0(uint_t v)
typename uint_dispatch_t< N >::type uint_t
constexpr uint8_t rank1_8bit[]
Lookup table for the rank operation on 8-bit values.
constexpr uint8_t rank1(uint8_t v)
Computes the amount of 1-bits in the binary representation of the given 8-bit value.