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[
static_cast<uint32_t
>(v * 0x07C4ACDDU) >> 27];
201 return val >> (64 - bits);
229 unsigned lz =
clz(buf);
230 unsigned length = lz + 1;
231 unsigned size = lz + length;
235 if (length > max_length || length > 16)
262 m_cache |=
static_cast<uint64_t
>(*m_buffer) << (shift - bits);
269 m_cache |=
static_cast<uint64_t
>(*m_buffer) >> (bits - shift);
278 #endif // BIT_READER_H