Skip to content

Commit

Permalink
Explicitly use uint64_t as the type of fingerprint to avoid type mism…
Browse files Browse the repository at this point in the history
…atch with some compilers.
  • Loading branch information
rmlarsen committed Oct 3, 2023
1 parent 8e0308b commit 57a2b4b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions passes/opt/opt_merge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ struct OptMergeWorker

CellTypes ct;
int total_count;
using FingerPrint = std::hash<std::string>::result_type;

static void sort_pmux_conn(dict<RTLIL::IdString, RTLIL::SigSpec> &conn)
{
Expand Down Expand Up @@ -78,7 +77,7 @@ struct OptMergeWorker
return str;
}

FingerPrint hash_cell_parameters_and_connections(const RTLIL::Cell *cell)
uint64_t hash_cell_parameters_and_connections(const RTLIL::Cell *cell)
{
vector<string> hash_conn_strings;
std::string hash_string = cell->type.str() + "\n";
Expand Down Expand Up @@ -267,13 +266,13 @@ struct OptMergeWorker
}

did_something = false;
dict<FingerPrint, RTLIL::Cell*> sharemap;
dict<uint64_t, RTLIL::Cell*> sharemap;
for (auto cell : cells)
{
if ((!mode_share_all && !ct.cell_known(cell->type)) || !cell->known())
continue;

FingerPrint hash = hash_cell_parameters_and_connections(cell);
uint64_t hash = hash_cell_parameters_and_connections(cell);
auto r = sharemap.insert(std::make_pair(hash, cell));
if (!r.second) {
if (compare_cell_parameters_and_connections(cell, r.first->second)) {
Expand Down

0 comments on commit 57a2b4b

Please sign in to comment.