| 199 | } |
| 200 | |
| 201 | void 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 | |
| 231 | void ByteOutputStream::appendBits( |
| 232 | const uint64_t* bits, |
no test coverage detected