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

Method appendBool

bolt/common/memory/ByteStream.cpp:201–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void ByteOutputStream::appendBool(bool value, int32_t count) {
202 BOLT_DCHECK(isBits_);
203
204 if (count == 1 && current_->size > current_->position) {
205 bits::setBit(
206 reinterpret_cast<uint64_t*>(current_->buffer),
207 current_->position,
208 value);
209 ++current_->position;
210 return;
211 }
212
213 int32_t offset{0};
214 for (;;) {
215 const int32_t bitsFit =
216 std::min(count - offset, current_->size - current_->position);
217 bits::fillBits(
218 reinterpret_cast<uint64_t*>(current_->buffer),
219 current_->position,
220 current_->position + bitsFit,
221 value);
222 current_->position += bitsFit;
223 offset += bitsFit;
224 if (offset == count) {
225 return;
226 }
227 extend(bits::nbytes(count - offset));
228 }
229}
230
231void ByteOutputStream::appendBits(
232 const uint64_t* bits,

Callers 3

appendNullMethod · 0.80
appendNonNullMethod · 0.80
appendNullsMethod · 0.80

Calls 4

fillBitsFunction · 0.85
nbytesFunction · 0.85
setBitFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected