diff options
author | Eddie Hung <eddieh@ece.ubc.ca> | 2019-02-26 12:04:16 -0800 |
---|---|---|
committer | Eddie Hung <eddieh@ece.ubc.ca> | 2019-02-26 12:04:16 -0800 |
commit | 3ea0161ae7f6111cb435c839eff694476a6527ab (patch) | |
tree | 85db69025e17eba4fbb7c3f9f68522cd020d4dfa | |
parent | 66b5f5166b358ae7efebd278ad32cd05f3eb72be (diff) | |
download | yosys-3ea0161ae7f6111cb435c839eff694476a6527ab.tar.gz yosys-3ea0161ae7f6111cb435c839eff694476a6527ab.tar.bz2 yosys-3ea0161ae7f6111cb435c839eff694476a6527ab.zip |
Add IdString::ends_with()
-rw-r--r-- | kernel/rtlil.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h index f877622aa..eb71fec7b 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -222,6 +222,12 @@ namespace RTLIL return std::string(c_str() + pos, len); } + bool ends_with(const char* suffix) const { + size_t len = strlen(suffix); + if (size() < len) return false; + return substr(size()-len) == suffix; + } + size_t size() const { return str().size(); } |