mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-21 21:33:40 +00:00
Use std::stoi instead of atoi(<str>.c_str())
This commit is contained in:
parent
e38f40af5b
commit
c11ad24fd7
36 changed files with 109 additions and 109 deletions
|
@ -1564,10 +1564,10 @@ struct AbcPass : public Pass {
|
|||
size_t pos = arg.find_first_of(':');
|
||||
int lut_mode = 0, lut_mode2 = 0;
|
||||
if (pos != string::npos) {
|
||||
lut_mode = atoi(arg.substr(0, pos).c_str());
|
||||
lut_mode2 = atoi(arg.substr(pos+1).c_str());
|
||||
lut_mode = std::stoi(arg.substr(0, pos));
|
||||
lut_mode2 = std::stoi(arg.substr(pos+1));
|
||||
} else {
|
||||
lut_mode = atoi(arg.c_str());
|
||||
lut_mode = std::stoi(arg);
|
||||
lut_mode2 = lut_mode;
|
||||
}
|
||||
lut_costs.clear();
|
||||
|
@ -1584,10 +1584,10 @@ struct AbcPass : public Pass {
|
|||
if (GetSize(parts) == 0 && !lut_costs.empty())
|
||||
lut_costs.push_back(lut_costs.back());
|
||||
else if (GetSize(parts) == 1)
|
||||
lut_costs.push_back(atoi(parts.at(0).c_str()));
|
||||
lut_costs.push_back(std::stoi(parts.at(0)));
|
||||
else if (GetSize(parts) == 2)
|
||||
while (GetSize(lut_costs) < atoi(parts.at(0).c_str()))
|
||||
lut_costs.push_back(atoi(parts.at(1).c_str()));
|
||||
while (GetSize(lut_costs) < std::stoi(parts.at(0)))
|
||||
lut_costs.push_back(std::stoi(parts.at(1)));
|
||||
else
|
||||
log_cmd_error("Invalid -luts syntax.\n");
|
||||
}
|
||||
|
|
|
@ -999,8 +999,8 @@ struct Abc9Pass : public Pass {
|
|||
size_t pos = arg.find_first_of(':');
|
||||
int lut_mode = 0, lut_mode2 = 0;
|
||||
if (pos != string::npos) {
|
||||
lut_mode = atoi(arg.substr(0, pos).c_str());
|
||||
lut_mode2 = atoi(arg.substr(pos+1).c_str());
|
||||
lut_mode = std::stoi(arg.substr(0, pos));
|
||||
lut_mode2 = std::stoi(arg.substr(pos+1));
|
||||
} else {
|
||||
pos = arg.find_first_of('.');
|
||||
if (pos != string::npos) {
|
||||
|
@ -1010,7 +1010,7 @@ struct Abc9Pass : public Pass {
|
|||
lut_file = std::string(pwd) + "/" + lut_file;
|
||||
}
|
||||
else {
|
||||
lut_mode = atoi(arg.c_str());
|
||||
lut_mode = std::stoi(arg);
|
||||
lut_mode2 = lut_mode;
|
||||
}
|
||||
}
|
||||
|
@ -1028,10 +1028,10 @@ struct Abc9Pass : public Pass {
|
|||
if (GetSize(parts) == 0 && !lut_costs.empty())
|
||||
lut_costs.push_back(lut_costs.back());
|
||||
else if (GetSize(parts) == 1)
|
||||
lut_costs.push_back(atoi(parts.at(0).c_str()));
|
||||
lut_costs.push_back(std::stoi(parts.at(0)));
|
||||
else if (GetSize(parts) == 2)
|
||||
while (GetSize(lut_costs) < atoi(parts.at(0).c_str()))
|
||||
lut_costs.push_back(atoi(parts.at(1).c_str()));
|
||||
while (GetSize(lut_costs) < std::stoi(parts.at(0)))
|
||||
lut_costs.push_back(std::stoi(parts.at(1)));
|
||||
else
|
||||
log_cmd_error("Invalid -luts syntax.\n");
|
||||
}
|
||||
|
|
|
@ -476,16 +476,16 @@ struct ExtractPass : public Pass {
|
|||
continue;
|
||||
}
|
||||
if (args[argidx] == "-mine_cells_span" && argidx+2 < args.size()) {
|
||||
mine_cells_min = atoi(args[++argidx].c_str());
|
||||
mine_cells_max = atoi(args[++argidx].c_str());
|
||||
mine_cells_min = std::stoi(args[++argidx]);
|
||||
mine_cells_max = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-mine_min_freq" && argidx+1 < args.size()) {
|
||||
mine_min_freq = atoi(args[++argidx].c_str());
|
||||
mine_min_freq = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-mine_limit_matches_per_module" && argidx+1 < args.size()) {
|
||||
mine_limit_mod = atoi(args[++argidx].c_str());
|
||||
mine_limit_mod = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-mine_split" && argidx+2 < args.size()) {
|
||||
|
@ -494,7 +494,7 @@ struct ExtractPass : public Pass {
|
|||
continue;
|
||||
}
|
||||
if (args[argidx] == "-mine_max_fanout" && argidx+1 < args.size()) {
|
||||
mine_max_fanout = atoi(args[++argidx].c_str());
|
||||
mine_max_fanout = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-verbose") {
|
||||
|
|
|
@ -613,7 +613,7 @@ struct ExtractCounterPass : public Pass {
|
|||
|
||||
if (args[argidx] == "-maxwidth" && argidx+1 < args.size())
|
||||
{
|
||||
maxwidth = atoi(args[++argidx].c_str());
|
||||
maxwidth = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,11 +580,11 @@ struct ExtractFaPass : public Pass {
|
|||
continue;
|
||||
}
|
||||
if (args[argidx] == "-d" && argidx+2 < args.size()) {
|
||||
config.maxdepth = atoi(args[++argidx].c_str());
|
||||
config.maxdepth = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-b" && argidx+2 < args.size()) {
|
||||
config.maxbreadth = atoi(args[++argidx].c_str());
|
||||
config.maxbreadth = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1525,12 +1525,12 @@ struct FlowmapPass : public Pass {
|
|||
{
|
||||
if (args[argidx] == "-maxlut" && argidx + 1 < args.size())
|
||||
{
|
||||
order = atoi(args[++argidx].c_str());
|
||||
order = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-minlut" && argidx + 1 < args.size())
|
||||
{
|
||||
minlut = atoi(args[++argidx].c_str());
|
||||
minlut = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-cells" && argidx + 1 < args.size())
|
||||
|
@ -1545,23 +1545,23 @@ struct FlowmapPass : public Pass {
|
|||
}
|
||||
if (args[argidx] == "-r-alpha" && argidx + 1 < args.size())
|
||||
{
|
||||
r_alpha = atoi(args[++argidx].c_str());
|
||||
r_alpha = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-r-beta" && argidx + 1 < args.size())
|
||||
{
|
||||
r_beta = atoi(args[++argidx].c_str());
|
||||
r_beta = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-r-gamma" && argidx + 1 < args.size())
|
||||
{
|
||||
r_gamma = atoi(args[++argidx].c_str());
|
||||
r_gamma = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-optarea" && argidx + 1 < args.size())
|
||||
{
|
||||
relax = true;
|
||||
optarea = atoi(args[++argidx].c_str());
|
||||
optarea = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-debug")
|
||||
|
|
|
@ -163,7 +163,7 @@ struct NlutmapPass : public Pass {
|
|||
vector<string> tokens = split_tokens(args[++argidx], ",");
|
||||
config.luts.clear();
|
||||
for (auto &token : tokens)
|
||||
config.luts.push_back(atoi(token.c_str()));
|
||||
config.luts.push_back(std::stoi(token));
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-assert") {
|
||||
|
|
|
@ -655,19 +655,19 @@ struct ShregmapPass : public Pass {
|
|||
continue;
|
||||
}
|
||||
if (args[argidx] == "-minlen" && argidx+1 < args.size()) {
|
||||
opts.minlen = atoi(args[++argidx].c_str());
|
||||
opts.minlen = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-maxlen" && argidx+1 < args.size()) {
|
||||
opts.maxlen = atoi(args[++argidx].c_str());
|
||||
opts.maxlen = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-keep_before" && argidx+1 < args.size()) {
|
||||
opts.keep_before = atoi(args[++argidx].c_str());
|
||||
opts.keep_before = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-keep_after" && argidx+1 < args.size()) {
|
||||
opts.keep_after = atoi(args[++argidx].c_str());
|
||||
opts.keep_after = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-tech" && argidx+1 < args.size() && opts.tech == nullptr) {
|
||||
|
|
|
@ -1072,7 +1072,7 @@ struct TechmapPass : public Pass {
|
|||
continue;
|
||||
}
|
||||
if (args[argidx] == "-max_iter" && argidx+1 < args.size()) {
|
||||
max_iter = atoi(args[++argidx].c_str());
|
||||
max_iter = std::stoi(args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-D" && argidx+1 < args.size()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue