MCPcopy Create free account
hub / github.com/bytedance/bolt / flush

Method flush

bolt/common/memory/ByteStream.cpp:315–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313}
314
315void ByteOutputStream::flush(OutputStream* out) {
316 updateEnd();
317 for (int32_t i = 0; i < ranges_.size(); ++i) {
318 int32_t count = i == ranges_.size() - 1 ? lastRangeEnd_ : ranges_[i].size;
319 int32_t bytes = isBits_ ? bits::nbytes(count) : count;
320 if (isBits_ && isReverseBitOrder_ && !isReversed_) {
321 bits::reverseBits(ranges_[i].buffer, bytes);
322 }
323 out->write(reinterpret_cast<char*>(ranges_[i].buffer), bytes);
324 }
325 if (isBits_ && isReverseBitOrder_) {
326 isReversed_ = true;
327 }
328}
329
330char* ByteOutputStream::writePosition() {
331 if (ranges_.empty()) {

Callers 1

TEST_FFunction · 0.45

Calls 4

nbytesFunction · 0.85
reverseBitsFunction · 0.85
sizeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected