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:
parent
f7ac724ea9
commit
ae219cb8f9
1 changed files with 2 additions and 2 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue