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
40 if(m_buffer_pos + input_size >= m_main_block_mod + m_final_minimum) {
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 =
50 round_down(std::min(m_buffer_pos, m_buffer_pos + input_size - m_final_minimum), m_main_block_mod);
51
53
54 m_buffer_pos -= total_to_consume;
55
56 copy_mem(m_buffer.data(), m_buffer.data() + total_to_consume, m_buffer_pos);
57 }
58
59 if(input_size >= m_final_minimum) {
60 size_t full_blocks = (input_size - m_final_minimum) / m_main_block_mod;
61 size_t to_copy = full_blocks * m_main_block_mod;
62
63 if(to_copy) {
65
66 input += to_copy;
67 input_size -= to_copy;
68 }
69 }
70
71 copy_mem(&m_buffer[m_buffer_pos], input, input_size);
72 m_buffer_pos += input_size;
73}
constexpr T round_down(T n, T align_to)
constexpr void copy_mem(T *out, const T *in, size_t n)