foobar2000 SDK  2015-08-03
Public Member Functions | Private Attributes
bitreader_helper::bitreader

#include <bitreader_helper.h>

Public Member Functions

 bitreader (const t_uint8 *p_ptr, t_size p_base)
 
t_size get_bitptr () const
 
t_size read (t_size p_bits)
 
bool read_bit ()
 
template<typename t_ret >
t_ret read_t (t_size p_bits)
 
void skip (t_size p_bits)
 

Private Attributes

t_size m_bitptr
 
const t_uint8m_ptr
 

Detailed Description

Definition at line 17 of file bitreader_helper.h.

Constructor & Destructor Documentation

bitreader_helper::bitreader::bitreader ( const t_uint8 p_ptr,
t_size  p_base 
)
inline

Definition at line 20 of file bitreader_helper.h.

21  : m_ptr(p_ptr), m_bitptr(p_base)
22  {
23  }

Member Function Documentation

t_size bitreader_helper::bitreader::get_bitptr ( ) const
inline

Definition at line 44 of file bitreader_helper.h.

t_size bitreader_helper::bitreader::read ( t_size  p_bits)
inline

Definition at line 42 of file bitreader_helper.h.

42 {return read_t<t_size>(p_bits);}
bool bitreader_helper::bitreader::read_bit ( )
inline

Definition at line 46 of file bitreader_helper.h.

46  {
47  bool state = ( (m_ptr[m_bitptr>>3] >> (7-(m_bitptr&7)))&1 ) != 0;
48  m_bitptr++;
49  return state;
50  }
template<typename t_ret >
t_ret bitreader_helper::bitreader::read_t ( t_size  p_bits)
inline

Definition at line 31 of file bitreader_helper.h.

31  {
32  t_ret ret = 0;
33  for(t_size bit=0;bit<p_bits;bit++)
34  {
35  ret <<= 1;
36  ret |= (m_ptr[m_bitptr>>3] >> (7-(m_bitptr&7)))&1;
37  m_bitptr++;
38  }
39  return ret;
40  }
size_t t_size
Definition: int_types.h:48
void bitreader_helper::bitreader::skip ( t_size  p_bits)
inline

Definition at line 25 of file bitreader_helper.h.

26  {
27  m_bitptr += p_bits;
28  }

Field Documentation

t_size bitreader_helper::bitreader::m_bitptr
private

Definition at line 55 of file bitreader_helper.h.

const t_uint8* bitreader_helper::bitreader::m_ptr
private

Definition at line 54 of file bitreader_helper.h.


The documentation for this class was generated from the following file: