Method is useful when first messages from buffer are processed, and the last message in buffer is incomplete, so we need to move partial message to the begin of the buffer and continue filling the buffer from the network.
| 115 | // message to the begin of the buffer and continue filling the buffer |
| 116 | // from the network. |
| 117 | inline void Chop(size_t pos, size_t count) { |
| 118 | const auto end = pos + count; |
| 119 | Y_ASSERT(end <= Pos_); |
| 120 | |
| 121 | if (count == 0) { |
| 122 | return; |
| 123 | } else if (count == Pos_) { |
| 124 | Pos_ = 0; |
| 125 | } else { |
| 126 | memmove(Data_ + pos, Data_ + end, Pos_ - end); |
| 127 | Pos_ -= count; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | inline void ChopHead(size_t count) { |
| 132 | Chop(0U, count); |
no test coverage detected