diff options
author | 2020-01-27 21:47:41 +0100 | |
---|---|---|
committer | 2020-01-27 21:47:41 +0100 | |
commit | f7d8a10da53e07747ab4f11d5c7b4827869e5763 (patch) | |
tree | 1ae8c2b3a06a6abd253814bd159cb151dd6cc20a /src/lib/netlist/tools/nl_convert.cpp | |
parent | 8c2bb6236774977e848c62fad35eb665a6d8e58b (diff) |
netlist: Code maintenance. (nw)
- Fixed some clang lint warnings
- Removed dead code
- Experimental parser code to allow calculations in parameter value.
This already works for compiled netlists. These changes are
currently disabled. Updated pong netlist (and CRC/SHA) to work
with this new code.
Diffstat (limited to 'src/lib/netlist/tools/nl_convert.cpp')
-rw-r--r-- | src/lib/netlist/tools/nl_convert.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/netlist/tools/nl_convert.cpp b/src/lib/netlist/tools/nl_convert.cpp index 0f59820a642..dfc98598a97 100644 --- a/src/lib/netlist/tools/nl_convert.cpp +++ b/src/lib/netlist/tools/nl_convert.cpp @@ -485,18 +485,18 @@ void nl_convert_spice_t::process_line(const pstring &line) } else { - int sce(4); - int scoeff(5 + n); - if ((tt.size() != 5 + 2 * n) || (tt[scoeff-1] != "0")) + unsigned sce(4); + auto scoeff(static_cast<unsigned>(5 + n)); + if ((tt.size() != 5 + 2 * static_cast<unsigned>(n)) || (tt[scoeff-1] != "0")) { out("// IGNORED {}: {}\n", tt[0].c_str(), line.c_str()); break; } pstring lastnet = tt[1]; - for (int i=0; i<n; i++) + for (std::size_t i=0; i < static_cast<std::size_t>(n); i++) { pstring devname = tt[0] + plib::pfmt("{}")(i); - pstring nextnet = (i<n-1) ? tt[1] + "a" + plib::pfmt("{}")(i) : tt[2]; + pstring nextnet = (i<static_cast<std::size_t>(n)-1) ? tt[1] + "a" + plib::pfmt("{}")(i) : tt[2]; auto net2 = plib::psplit(plib::replace_all(plib::replace_all(tt[sce+i],")",""),"(",""),","); add_device("VCVS", devname); add_term(lastnet, devname, 0); @@ -519,8 +519,8 @@ void nl_convert_spice_t::process_line(const pstring &line) case 'F': { auto n=npoly(tt[3]); - int sce(4); - int scoeff(5 + n); + unsigned sce(4); + unsigned scoeff(5 + static_cast<unsigned>(n)); if (n<0) { sce = 3; @@ -529,13 +529,13 @@ void nl_convert_spice_t::process_line(const pstring &line) } else { - if ((tt.size() != 5 + 2 * n) || (tt[scoeff-1] != "0")) + if ((tt.size() != 5 + 2 * static_cast<unsigned>(n)) || (tt[scoeff-1] != "0")) { out("// IGNORED {}: {}\n", tt[0].c_str(), line.c_str()); break; } } - for (int i=0; i<n; i++) + for (std::size_t i=0; i < static_cast<std::size_t>(n); i++) { pstring devname = tt[0] + plib::pfmt("{}")(i); add_device("CCCS", devname); |