MCPcopy Create free account
hub / github.com/bytedance/bolt / linearSearchSimple

Function linearSearchSimple

bolt/type/StringView.cpp:36–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34
35namespace {
36int32_t linearSearchSimple(
37 StringView key,
38 const StringView* strings,
39 const int32_t* indices,
40 int32_t numStrings) {
41 if (indices) {
42 for (auto i = 0; i < numStrings; ++i) {
43 if (strings[indices[i]] == key) {
44 return i;
45 }
46 }
47 } else {
48 for (auto i = 0; i < numStrings; ++i) {
49 if (strings[i] == key) {
50 return i;
51 }
52 }
53 }
54 return -1;
55}
56
57} // namespace
58

Callers 1

linearSearchMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected