34 #if __has_include(<bit>) // C++20
118 unsigned lz =
clz(buf);
119 unsigned length = lz + 1;
163 static unsigned clz(uint32_t v)
165 #if defined(__cpp_lib_bitops) && __cpp_lib_bitops >= 201907L // C++20 <bit>
166 return std::countl_zero(v);
174 static constexpr std::array<int,32> MultiplyDeBruijnBitPosition =
176 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
177 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
186 return 31 - MultiplyDeBruijnBitPosition[(uint32_t)(v * 0x07C4ACDDU) >> 27];
201 return val >> (64 - bits);
227 unsigned lz =
clz(buf);
228 unsigned length = lz + 1;
229 unsigned size = lz + length;
233 if (length > max_length || length > 16)
266 #endif // BIT_READER_H