MCPcopy Create free account
hub / github.com/catboost/catboost / Chop

Method Chop

util/generic/buffer.h:117–129  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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);

Callers 5

RemoveFinalSlashFunction · 0.80
PrintUsageMethod · 0.80
DoExecuteMethod · 0.80
Y_UNIT_TESTFunction · 0.80
Y_UNIT_TESTFunction · 0.80

Calls 1

memmoveFunction · 0.85

Tested by

no test coverage detected