3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-22 13:41:27 +00:00

Make IdString::contains take std::string_view so we avoid a strlen when the parameter is a string constant

This commit is contained in:
Robert O'Callahan 2025-10-16 04:05:56 +00:00 committed by Emil J. Tywoniak
parent 2319d82efb
commit 32641bbf93

View file

@ -416,8 +416,8 @@ struct RTLIL::IdString
return compare(sz - suffix.size(), suffix.size(), suffix.data()) == 0;
}
bool contains(const char* str) const {
return strstr(c_str(), str);
bool contains(std::string_view s) const {
return std::string_view(c_str()).find(s) != std::string::npos;
}
size_t size() const {