\brief Branchless boundschecking of the values. Processes batches of values at a time and shortcircuits when encountering an out-of-bounds index in a batch
| 564 | /// values at a time and shortcircuits when encountering an out-of-bounds |
| 565 | /// index in a batch |
| 566 | Status CheckIndexBounds(const ArraySpan& values, uint64_t upper_limit) { |
| 567 | switch (values.type->id()) { |
| 568 | case Type::INT8: |
| 569 | return CheckIndexBoundsImpl<int8_t>(values, upper_limit); |
| 570 | case Type::INT16: |
| 571 | return CheckIndexBoundsImpl<int16_t>(values, upper_limit); |
| 572 | case Type::INT32: |
| 573 | return CheckIndexBoundsImpl<int32_t>(values, upper_limit); |
| 574 | case Type::INT64: |
| 575 | return CheckIndexBoundsImpl<int64_t>(values, upper_limit); |
| 576 | case Type::UINT8: |
| 577 | return CheckIndexBoundsImpl<uint8_t>(values, upper_limit); |
| 578 | case Type::UINT16: |
| 579 | return CheckIndexBoundsImpl<uint16_t>(values, upper_limit); |
| 580 | case Type::UINT32: |
| 581 | return CheckIndexBoundsImpl<uint32_t>(values, upper_limit); |
| 582 | case Type::UINT64: |
| 583 | return CheckIndexBoundsImpl<uint64_t>(values, upper_limit); |
| 584 | default: |
| 585 | return Status::Invalid("Invalid index type for boundschecking"); |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | // ---------------------------------------------------------------------- |
| 590 | // Utilities for casting from one integer type to another |