Skip to content

Commit

Permalink
irep serialisation: do not use string hash
Browse files Browse the repository at this point in the history
We want string numbering, not string hashing. For `dstringt` these are
interchangeable, but that's not the case for `std::string`.
  • Loading branch information
tautschnig committed Dec 14, 2023
1 parent 0b9e110 commit 6c21ed6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/util/irep_serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ Date: May 2007

#include "irep_serialization.h"

#include "exception_utils.h"
#include "string_container.h"

#include <climits>
#include <iostream>

#include "exception_utils.h"

void irep_serializationt::write_irep(
std::ostream &out,
const irept &irep)
Expand Down Expand Up @@ -211,7 +212,11 @@ void irep_serializationt::write_string_ref(
std::ostream &out,
const irep_idt &s)
{
size_t id=irep_id_hash()(s);
#ifdef USE_DSTRING
size_t id = s.get_no();
#else
size_t id = get_string_container()[s];
#endif
if(id>=ireps_container.string_map.size())
ireps_container.string_map.resize(id+1, false);

Expand Down

0 comments on commit 6c21ed6

Please sign in to comment.