diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-08-07 12:20:08 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-08-07 12:20:08 -0700 |
commit | 6d77236f3845cd8785e7bdd4da3c5ef966be6043 (patch) | |
tree | 9a55ec79ecd07e4077dbb90634be19e168b15e48 /passes/opt/opt_clean.cc | |
parent | 71eff6f0deae3ffaf75cca22768b66a2dc918b3e (diff) | |
download | yosys-6d77236f3845cd8785e7bdd4da3c5ef966be6043.tar.gz yosys-6d77236f3845cd8785e7bdd4da3c5ef966be6043.tar.bz2 yosys-6d77236f3845cd8785e7bdd4da3c5ef966be6043.zip |
substr() -> compare()
Diffstat (limited to 'passes/opt/opt_clean.cc')
-rw-r--r-- | passes/opt/opt_clean.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/passes/opt/opt_clean.cc b/passes/opt/opt_clean.cc index a8a8e0bc7..905c95b6c 100644 --- a/passes/opt/opt_clean.cc +++ b/passes/opt/opt_clean.cc @@ -222,10 +222,10 @@ bool compare_signals(RTLIL::SigBit &s1, RTLIL::SigBit &s2, SigPool ®s, SigPoo bool check_public_name(RTLIL::IdString id) { - const std::string &id_str = id.str(); - if (id_str[0] == '$') + if (id.begins_with("$")) return false; - if (id_str.substr(0, 2) == "\\_" && (id_str[id_str.size()-1] == '_' || id_str.find("_[") != std::string::npos)) + const std::string &id_str = id.str(); + if (id.begins_with("\\_") && (id.ends_with("_") || id_str.find("_[") != std::string::npos)) return false; if (id_str.find(".$") != std::string::npos) return false; |