| 707 | }; |
| 708 | |
| 709 | bool CompareArrayRanges(const ArrayData& left, const ArrayData& right, |
| 710 | int64_t left_start_idx, int64_t left_end_idx, |
| 711 | int64_t right_start_idx, const EqualOptions& options) { |
| 712 | if (left.type->id() != right.type->id() || |
| 713 | !TypeEquals(*left.type, *right.type, false /* check_metadata */)) { |
| 714 | return false; |
| 715 | } |
| 716 | |
| 717 | const int64_t range_length = left_end_idx - left_start_idx; |
| 718 | DCHECK_GE(range_length, 0); |
| 719 | if (left_start_idx + range_length > left.length) { |
| 720 | // Left range too small |
| 721 | return false; |
| 722 | } |
| 723 | if (right_start_idx + range_length > right.length) { |
| 724 | // Right range too small |
| 725 | return false; |
| 726 | } |
| 727 | if (&left == &right && left_start_idx == right_start_idx && |
| 728 | IdentityImpliesEquality(*left.type, options)) { |
| 729 | return true; |
| 730 | } |
| 731 | // Compare values |
| 732 | RangeDataEqualsImpl impl(options, left, right, left_start_idx, right_start_idx, |
| 733 | range_length); |
| 734 | return impl.Compare(); |
| 735 | } |
| 736 | |
| 737 | class TypeEqualsVisitor { |
| 738 | public: |
no test coverage detected