| 464 | |
| 465 | template <typename Visit> |
| 466 | inline Status VisitBitRuns(const uint8_t* bitmap, int64_t offset, int64_t length, |
| 467 | Visit&& visit) { |
| 468 | if (bitmap == NULLPTR) { |
| 469 | // Assuming all set (as in a null bitmap) |
| 470 | return visit(static_cast<int64_t>(0), length, true); |
| 471 | } |
| 472 | BitRunReader reader(bitmap, offset, length); |
| 473 | int64_t position = 0; |
| 474 | while (true) { |
| 475 | const auto run = reader.NextRun(); |
| 476 | if (run.length == 0) { |
| 477 | break; |
| 478 | } |
| 479 | ARROW_RETURN_NOT_OK(visit(position, run.length, run.set)); |
| 480 | position += run.length; |
| 481 | } |
| 482 | return Status::OK(); |
| 483 | } |
| 484 | |
| 485 | // XXX: Try to make this function small so the compiler can inline and optimize |
| 486 | // the `visit` function, which is normally a hot loop with vectorizable code. |
no test coverage detected