Write bytes into the buffered filter, which will them emit them in calls to buffered_block in the subclass
35 {
36 if(!input_size)
37 return;
38
39 if(m_buffer_pos + input_size >= m_main_block_mod + m_final_minimum)
40 {
41 size_t to_copy = std::min<size_t>(m_buffer.size() - m_buffer_pos, input_size);
42
43 copy_mem(&m_buffer[m_buffer_pos], input, to_copy);
44 m_buffer_pos += to_copy;
45
46 input += to_copy;
47 input_size -= to_copy;
48
49 size_t total_to_consume =
51 m_buffer_pos + input_size - m_final_minimum),
52 m_main_block_mod);
53
55
56 m_buffer_pos -= total_to_consume;
57
58 copy_mem(m_buffer.data(), m_buffer.data() + total_to_consume, m_buffer_pos);
59 }
60
61 if(input_size >= m_final_minimum)
62 {
63 size_t full_blocks = (input_size - m_final_minimum) / m_main_block_mod;
64 size_t to_copy = full_blocks * m_main_block_mod;
65
66 if(to_copy)
67 {
69
70 input += to_copy;
71 input_size -= to_copy;
72 }
73 }
74
75 copy_mem(&m_buffer[m_buffer_pos], input, input_size);
76 m_buffer_pos += input_size;
77 }
constexpr T round_down(T n, T align_to)
void copy_mem(T *out, const T *in, size_t n)