37 #ifndef BOOST_BEAST_ZLIB_DETAIL_BITSTREAM_HPP 38 #define BOOST_BEAST_ZLIB_DETAIL_BITSTREAM_HPP 40 #include <boost/assert.hpp> 51 using value_type = std::uint32_t;
68 BOOST_ASSERT(n <= n_);
69 n_ -=
static_cast<unsigned>(n);
91 fill(std::size_t n, FwdIt& first, FwdIt
const& last);
104 template<
class Un
signed>
106 peek(Unsigned& value, std::size_t n);
116 template<
class Un
signed>
118 read(Unsigned& value, std::size_t n);
121 template<
class B
idirIt>
126 template<
class FwdIt>
130 fill(std::size_t n, FwdIt& first, FwdIt
const& last)
136 v_ +=
static_cast<value_type
>(*first++) << n_;
142 template<
class FwdIt>
148 v_ +=
static_cast<value_type
>(*it++) << n_;
152 template<
class FwdIt>
158 v_ +=
static_cast<value_type
>(*it++) << n_;
160 v_ +=
static_cast<value_type
>(*it++) << n_;
164 template<
class Un
signed>
168 peek(Unsigned& value, std::size_t n)
170 BOOST_ASSERT(n <=
sizeof(value)*8);
171 BOOST_ASSERT(n <= n_);
172 value =
static_cast<Unsigned
>(
173 v_ & ((1ULL << n) - 1));
176 template<
class Un
signed>
180 read(Unsigned& value, std::size_t n)
182 BOOST_ASSERT(n <
sizeof(v_)*8);
183 BOOST_ASSERT(n <= n_);
184 value =
static_cast<Unsigned
>(
185 v_ & ((1ULL << n) - 1));
187 n_ -=
static_cast<unsigned>(n);
190 template<
class B
idirIt>
197 it = std::prev(it, len);
199 v_ &= (1U << n_) - 1;
void read(Unsigned &value, std::size_t n)
Definition: bitstream.hpp:180
Definition: async_result.hpp:20
bool fill(std::size_t n, FwdIt &first, FwdIt const &last)
Definition: bitstream.hpp:130
value_type peek_fast() const
Definition: bitstream.hpp:110
void rewind(BidirIt &it)
Definition: bitstream.hpp:194
Definition: bitstream.hpp:49
unsigned size() const
Definition: bitstream.hpp:59
void peek(Unsigned &value, std::size_t n)
Definition: bitstream.hpp:168
void flush_byte()
Definition: bitstream.hpp:83
void fill_16(FwdIt &it)
Definition: bitstream.hpp:156
void drop(std::size_t n)
Definition: bitstream.hpp:66
void flush()
Definition: bitstream.hpp:75
void fill_8(FwdIt &it)
Definition: bitstream.hpp:146