Comparisons
| 583 | |
| 584 | // Comparisons |
| 585 | int compare(Standalone<VectorRef<unsigned char>> const& v1, Standalone<VectorRef<unsigned char>> const& v2) { |
| 586 | size_t i = 0; |
| 587 | while (i < v1.size() && i < v2.size()) { |
| 588 | if (v1[i] < v2[i]) { |
| 589 | return -1; |
| 590 | } else if (v1[i] > v2[i]) { |
| 591 | return 1; |
| 592 | } |
| 593 | i += 1; |
| 594 | } |
| 595 | |
| 596 | if (i < v1.size()) { |
| 597 | return 1; |
| 598 | } |
| 599 | if (i < v2.size()) { |
| 600 | return -1; |
| 601 | } |
| 602 | return 0; |
| 603 | } |
| 604 | |
| 605 | bool Tuple::operator==(Tuple const& other) const { |
| 606 | return compare(data, other.data) == 0; |
no test coverage detected