MCPcopy Create free account
hub / github.com/apple/foundationdb / compare

Function compare

bindings/flow/Tuple.cpp:585–603  ·  view source on GitHub ↗

Comparisons

Source from the content-addressed store, hash-verified

583
584// Comparisons
585int 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
605bool Tuple::operator==(Tuple const& other) const {
606 return compare(data, other.data) == 0;

Callers 7

operator==Method · 0.70
operator!=Method · 0.70
operator<Method · 0.70
operator<=Method · 0.70
operator>Method · 0.70
operator>=Method · 0.70
_compare_elemsMethod · 0.50

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected