MCPcopy Create free account
hub / github.com/alibaba/graph-learn / compare

Method compare

graphlearn/src/common/string/lite_string.h:121–131  ·  view source on GitHub ↗

< 0 if "*this" < "b", == 0 if "*this" == "b", > 0 if "*this" > "b"

Source from the content-addressed store, hash-verified

119 // == 0 if "*this" == "b",
120 // > 0 if "*this" > "b"
121 int32_t compare(LiteString b) const {
122 const size_t min_len = (size_ < b.size_) ? size_ : b.size_;
123 int r = memcmp(data_, b.data_, min_len);
124 if (r == 0) {
125 if (size_ < b.size_)
126 r = -1;
127 else if (size_ > b.size_)
128 r = +1;
129 }
130 return r;
131 }
132
133 bool contains(LiteString s) const;
134 LiteString substr(size_t pos, size_t n = npos) const;

Callers 4

operator<Function · 0.80
operator>Function · 0.80
operator<=Function · 0.80
operator>=Function · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected