aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rtlil.h
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-08-06 16:42:25 -0700
committerEddie Hung <eddie@fpgeh.com>2019-08-06 16:42:25 -0700
commite38f40af5b7cdd5c8b896ffba17069bd65f01f29 (patch)
treeec5f7fa67819eb54a7318b1e7e005303905bf694 /kernel/rtlil.h
parenta6bc9265fbb2abad73120a068a09f0c7833304de (diff)
downloadyosys-e38f40af5b7cdd5c8b896ffba17069bd65f01f29.tar.gz
yosys-e38f40af5b7cdd5c8b896ffba17069bd65f01f29.tar.bz2
yosys-e38f40af5b7cdd5c8b896ffba17069bd65f01f29.zip
Use IdString::begins_with()
Diffstat (limited to 'kernel/rtlil.h')
-rw-r--r--kernel/rtlil.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index 1cfe71473..d7e036431 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -276,20 +276,24 @@ namespace RTLIL
return std::string(c_str() + pos, len);
}
+ int compare(size_t pos, size_t len, const char* s) const {
+ return strncmp(c_str()+pos, s, len);
+ }
+
bool begins_with(const char* prefix) const {
size_t len = strlen(prefix);
if (size() < len) return false;
- return substr(0, len) == prefix;
+ return compare(0, len, prefix);
}
bool ends_with(const char* suffix) const {
size_t len = strlen(suffix);
if (size() < len) return false;
- return substr(size()-len) == suffix;
+ return compare(size()-len, len, suffix);
}
size_t size() const {
- return str().size();
+ return strlen(c_str());
}
bool empty() const {