MCPcopy Create free account
hub / github.com/apache/impala / find_last_not_of

Method find_last_not_of

be/src/gutil/strings/stringpiece.cc:187–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187int StringPiece::find_last_not_of(StringPiece s, size_type pos) const {
188 if (length_ <= 0) return npos;
189
190 int i = min(pos, static_cast<size_type>(length_ - 1));
191 if (s.length_ <= 0) return i;
192
193 // Avoid the cost of BuildLookupTable() for a single-character search.
194 if (s.length_ == 1) return find_last_not_of(s.ptr_[0], pos);
195
196 bool lookup[UCHAR_MAX + 1] = { false };
197 BuildLookupTable(s, lookup);
198 for (; i >= 0; --i) {
199 if (!lookup[static_cast<unsigned char>(ptr_[i])]) {
200 return i;
201 }
202 }
203 return npos;
204}
205
206int StringPiece::find_last_not_of(char c, size_type pos) const {
207 if (length_ <= 0) return npos;

Callers

nothing calls this directly

Calls 2

minFunction · 0.85
BuildLookupTableFunction · 0.85

Tested by

no test coverage detected