| 330 | } |
| 331 | |
| 332 | Result<std::shared_ptr<Buffer>> OptionalBitmapAnd(MemoryPool* pool, |
| 333 | const std::shared_ptr<Buffer>& left, |
| 334 | int64_t left_offset, |
| 335 | const std::shared_ptr<Buffer>& right, |
| 336 | int64_t right_offset, int64_t length, |
| 337 | int64_t out_offset) { |
| 338 | if (left == nullptr && right == nullptr) { |
| 339 | return nullptr; |
| 340 | } |
| 341 | if (left == nullptr) { |
| 342 | if (right_offset >= out_offset && (right_offset - out_offset) % 8 == 0) { |
| 343 | int64_t byte_shift = (right_offset - out_offset) / 8; |
| 344 | int64_t byte_length = bit_util::BytesForBits(out_offset + length); |
| 345 | return SliceBuffer(right, byte_shift, byte_length); |
| 346 | } |
| 347 | return CopyBitmap(pool, right->data(), right_offset, length, out_offset); |
| 348 | } |
| 349 | if (right == nullptr) { |
| 350 | if (left_offset >= out_offset && (left_offset - out_offset) % 8 == 0) { |
| 351 | int64_t byte_shift = (left_offset - out_offset) / 8; |
| 352 | int64_t byte_length = bit_util::BytesForBits(out_offset + length); |
| 353 | return SliceBuffer(left, byte_shift, byte_length); |
| 354 | } |
| 355 | return CopyBitmap(pool, left->data(), left_offset, length, out_offset); |
| 356 | } |
| 357 | |
| 358 | return BitmapAnd(pool, left->data(), left_offset, right->data(), right_offset, length, |
| 359 | out_offset); |
| 360 | } |
| 361 | |
| 362 | namespace { |
| 363 |
no test coverage detected