3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-03 13:07:58 +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
parent f7ac724ea9
commit ae219cb8f9

View file

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