| 681 | }; |
| 682 | |
| 683 | bool CompareArrayRanges(const ArrayData& left, const ArrayData& right, |
| 684 | int64_t left_start_idx, int64_t left_end_idx, |
| 685 | int64_t right_start_idx, const EqualOptions& options, |
| 686 | bool floating_approximate) { |
| 687 | if (left.type->id() != right.type->id() || |
| 688 | !TypeEquals(*left.type, *right.type, false /* check_metadata */)) { |
| 689 | return false; |
| 690 | } |
| 691 | |
| 692 | const int64_t range_length = left_end_idx - left_start_idx; |
| 693 | DCHECK_GE(range_length, 0); |
| 694 | if (left_start_idx + range_length > left.length) { |
| 695 | // Left range too small |
| 696 | return false; |
| 697 | } |
| 698 | if (right_start_idx + range_length > right.length) { |
| 699 | // Right range too small |
| 700 | return false; |
| 701 | } |
| 702 | if (&left == &right && left_start_idx == right_start_idx && |
| 703 | IdentityImpliesEquality(*left.type, options)) { |
| 704 | return true; |
| 705 | } |
| 706 | // Compare values |
| 707 | RangeDataEqualsImpl impl(options, floating_approximate, left, right, left_start_idx, |
| 708 | right_start_idx, range_length); |
| 709 | return impl.Compare(); |
| 710 | } |
| 711 | |
| 712 | class TypeEqualsVisitor { |
| 713 | public: |
no test coverage detected