Skip to content

Commit 1af075c

Browse files
author
Daniel Kroening
authored
Merge pull request #908 from reuk/enable-sharing
Fix SHARING behaviour
2 parents c4412e9 + 952680e commit 1af075c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/util/irep.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ class irept
102102
bool is_nil() const { return id()==ID_nil; }
103103
bool is_not_nil() const { return id()!=ID_nil; }
104104

105-
explicit irept(const irep_idt &_id):data(&empty_d)
105+
explicit irept(const irep_idt &_id)
106+
#ifdef SHARING
107+
:data(&empty_d)
108+
#endif
106109
{
107110
id(_id);
108111
}

src/util/merge_irep.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@ class merged_irept:public irept
2020
{
2121
// We assume that both are in the same container,
2222
// which isn't checked.
23-
return data==other.data;
23+
return &read()==&other.read();
2424
}
2525

2626
bool operator<(const merged_irept &other) const
2727
{
2828
// again, assumes that both are in the same container
29-
return ((std::size_t)data)<((std::size_t)other.data);
29+
return &read()<&other.read();
3030
}
3131

32-
std::size_t hash() const { return (std::size_t)data; }
32+
std::size_t hash() const
33+
{
34+
return reinterpret_cast<std::size_t>(&read());
35+
}
3336

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

0 commit comments

Comments
 (0)