Skip to content

Commit

Permalink
Turn 'm_var_invmap' into a much simpler (and faster) vector
Browse files Browse the repository at this point in the history
  • Loading branch information
SSoelvsten committed Feb 1, 2023
1 parent 9d3fc16 commit c258811
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/qbf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class qcir
/// \details If you want to find the Cleansed Input Variable from its name,
/// just use `m_gvar_map` to find the gate and its `var` member.
//////////////////////////////////////////////////////////////////////////////
std::unordered_map<size_t, std::string> m_var_invmap;
std::vector<std::string> m_var_invmap;

//////////////////////////////////////////////////////////////////////////////
/// \brief List of gates.
Expand Down Expand Up @@ -834,7 +834,7 @@ class qcir
if (vars() <= static_cast<unsigned int>(std::abs(i))) {
throw std::out_of_range("Given 'i' is an unknown variable");
}
return (i < 0 ? "-" : "") + (*m_var_invmap.find(std::abs(i))).second;
return (i < 0 ? "-" : "") + m_var_invmap.at(std::abs(i));
}

//////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -907,7 +907,7 @@ class qcir
}

const int cvar = m_vars++;
m_var_invmap.insert({ cvar, var });
m_var_invmap.push_back(var);
return (negated ? -1 : 1) * __push_gate(unnegated_var, 0u, var_gate(cvar));
}

Expand Down

0 comments on commit c258811

Please sign in to comment.