4 return (p_stream[p_offset>>3] >> (7-(p_offset&7)))&1;
9 size_t offset = p_base;
10 for(
size_t bit=0;bit<p_width;bit++) {
30 template<
typename t_ret>
33 for(
t_size bit=0;bit<p_bits;bit++)
65 for(
t_size bit=0;bit<p_bits;bit++) {
66 if (m_buffer_ptr == 0)
67 m_file->read_object(&m_buffer,1,p_abort);
70 ret |= (m_buffer >> (7-m_buffer_ptr))&1;
71 m_buffer_ptr = (m_buffer_ptr+1) & 7;
77 for(
t_size bit=0;bit<p_bits;bit++) {
78 if (m_buffer_ptr == 0) m_file->read_object(&m_buffer,1,p_abort);
79 m_buffer_ptr = (m_buffer_ptr+1) & 7;
101 if (p_bits > m_remaining)
throw exception_io_data_truncation();
102 m_remaining -= p_bits;
103 m_reader.skip(p_bits);
108 if (p_bits > m_remaining)
throw exception_io_data_truncation();
109 m_remaining -= p_bits;
110 return m_reader.read(p_bits);
119 return bitreader(p_buffer,p_base).read(p_count);
t_size read(t_size p_bits)
t_size read(t_size p_bits, abort_callback &p_abort)
bitreader_limited(const t_uint8 *p_ptr, t_size p_base, t_size p_remaining)
t_size read(t_size p_bits)
static t_size extract_bits(const t_uint8 *p_buffer, t_size p_base, t_size p_count)
bitreader(const t_uint8 *p_ptr, t_size p_base)
bitreader_fromfile(service_ptr_t< file > const &p_file)
t_size get_bitptr() const
t_size get_remaining() const
void skip(t_size p_bits, abort_callback &p_abort)
t_ret read_t(t_size p_bits)
static size_t extract_int(const t_uint8 *p_stream, size_t p_base, size_t p_width)
t_size get_bitptr() const
service_ptr_t< file > m_file
static size_t extract_bit(const t_uint8 *p_stream, size_t p_offset)