foobar2000 SDK  2015-08-03
Functions
bitWriter Namespace Reference

Functions

static void set_bit (t_uint8 *p_stream, size_t p_offset, bool state)
 
static void set_bits (t_uint8 *stream, t_size offset, t_size word, t_size bits)
 

Function Documentation

static void bitWriter::set_bit ( t_uint8 p_stream,
size_t  p_offset,
bool  state 
)
static

Definition at line 4 of file base64.cpp.

4  {
5  t_uint8 mask = 1 << (7-(p_offset&7));
6  t_uint8 & byte = p_stream[p_offset>>3];
7  byte = (byte & ~mask) | (state ? mask : 0);
8  }
uint8_t t_uint8
Definition: int_types.h:9
t_uint8 byte
Definition: mp3_utils.h:11
static void bitWriter::set_bits ( t_uint8 stream,
t_size  offset,
t_size  word,
t_size  bits 
)
static

Definition at line 9 of file base64.cpp.

9  {
10  for(t_size walk = 0; walk < bits; ++walk) {
11  t_uint8 bit = (t_uint8)((word >> (bits - walk - 1))&1);
12  set_bit(stream, offset+walk, bit != 0);
13  }
14  }
uint8_t t_uint8
Definition: int_types.h:9
static void set_bit(t_uint8 *p_stream, size_t p_offset, bool state)
Definition: base64.cpp:4
size_t t_size
Definition: int_types.h:48