Commit 3a3e5d4b authored by Guillaume Sadegh's avatar Guillaume Sadegh
Browse files

* src/tgba/tgbacomplement.cc (state_complement::hash): Improve

	the hash function.
parent 8fe11196
2009-06-07 Guillaume Sadegh <sadegh@lrde.epita.fr>
* src/tgba/tgbacomplement.cc (state_complement::hash): Improve
the hash function.
2009-06-09 Damien Lefortier <dam@lrde.epita.fr>
* src/eltlparse/eltlparse.yy: Fix a memory leak.
......
......@@ -106,6 +106,7 @@ namespace spot
const safra_tree& operator=(const safra_tree& other);
int compare(const safra_tree* other) const;
size_t hash() const;
void add_node(const state* s);
int max_name() const;
......@@ -232,6 +233,24 @@ namespace spot
return 0;
}
/// \brief Hash a safra tree.
size_t
safra_tree::hash() const
{
size_t hash = 0;
hash ^= wang32_hash(name);
hash ^= wang32_hash(marked);
for (subset_t::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
hash ^= (*i)->hash();
for (child_list::const_iterator i = children.begin(); i != children.end(); ++i)
hash ^= (*i)->hash();
return hash;
}
void
safra_tree::add_node(const state* s)
{
......@@ -912,7 +931,17 @@ namespace spot
size_t
state_complement::hash() const
{
return 0; // \todo
size_t hash = tree->hash();
hash ^= wang32_hash(use_bitset);
size_t size_bitset = L.size();
for (unsigned i = 0; i < size_bitset; ++i)
{
hash ^= wang32_hash(L[i]);
hash ^= wang32_hash(U[i]); // \todo To not apply for TGBAs
}
return hash;
}
state_complement*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment