| 98 | } |
| 99 | |
| 100 | void local_receive_buffer::shift_front() { |
| 101 | if (start_ == 0) { |
| 102 | return; |
| 103 | } |
| 104 | // Do NOT: |
| 105 | // * Use iterator arithmetics as it relies on ptrdiff_t which is int32_t on a u32 architecture, |
| 106 | // but the max message size that needs support is of uint32_t::max. |
| 107 | // * memcpy as the regions might overlapp and this is u.b. then |
| 108 | std::copy(mem_.data() + start_, mem_.data() + end_, mem_.data()); |
| 109 | end_ -= start_; |
| 110 | start_ = 0; |
| 111 | } |
| 112 | |
| 113 | void local_receive_buffer::shrink() { |
| 114 | mem_.resize(initial_buffer_size_, 0x0); |