MCPcopy Create free account
hub / github.com/catboost/catboost / FastHasPrefix

Function FastHasPrefix

library/cpp/expression/expression.cpp:15–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15static inline bool FastHasPrefix(const TStringBuf& suffix, const TStringBuf& prefix) {
16 if (suffix.size() < prefix.size()) {
17 return false;
18 }
19
20 switch (prefix.size()) {
21 case 1:
22 return suffix[0] == prefix[0];
23 case 2:
24 return ReadUnaligned<ui16>(suffix.data()) == ReadUnaligned<ui16>(prefix.data());
25 }
26 return suffix.StartsWith(prefix);
27}
28
29enum TExpressionOperation {
30 EO_BEGIN,

Callers 2

FindOperationFunction · 0.85
FindOperationMethod · 0.85

Calls 3

sizeMethod · 0.45
dataMethod · 0.45
StartsWithMethod · 0.45

Tested by

no test coverage detected