Skip to content

Fix SHARING behaviour #908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/util/irep.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ class irept
bool is_nil() const { return id()==ID_nil; }
bool is_not_nil() const { return id()!=ID_nil; }

explicit irept(const irep_idt &_id):data(&empty_d)
explicit irept(const irep_idt &_id)
#ifdef SHARING
:data(&empty_d)
#endif
{
id(_id);
}
Expand Down
9 changes: 6 additions & 3 deletions src/util/merge_irep.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ class merged_irept:public irept
{
// We assume that both are in the same container,
// which isn't checked.
return data==other.data;
return &read()==&other.read();
}

bool operator<(const merged_irept &other) const
{
// again, assumes that both are in the same container
return ((std::size_t)data)<((std::size_t)other.data);
return &read()<&other.read();
}

std::size_t hash() const { return (std::size_t)data; }
std::size_t hash() const
{
return reinterpret_cast<std::size_t>(&read());
}

// copy constructor: will only copy from other merged_irepts
merged_irept(const merged_irept &_src):irept(_src)
Expand Down