Commit ee546210 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

* src/tgba/tgbatba.cc (state_tba_proxy::hash): Use wang32_hash.

* src/tgba/tgbaproduct.cc (state_product::hash): Likewise.
parent dfb832cf
2004-11-16 Alexandre Duret-Lutz <adl@src.lip6.fr> 2004-11-16 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/tgba/tgbatba.cc (state_tba_proxy::hash): Use wang32_hash.
* src/tgba/tgbaproduct.cc (state_product::hash): Likewise.
* src/misc/hashfunc.hh (wang32_hash): New file and function, * src/misc/hashfunc.hh (wang32_hash): New file and function,
extracted from... extracted from...
* src/evtgba/product.cc (evtgba_product_state::hash): ... here. * src/evtgba/product.cc (evtgba_product_state::hash): ... here.
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "tgbaproduct.hh" #include "tgbaproduct.hh"
#include <string> #include <string>
#include <cassert> #include <cassert>
#include "misc/hashfunc.hh"
namespace spot namespace spot
{ {
...@@ -56,8 +57,8 @@ namespace spot ...@@ -56,8 +57,8 @@ namespace spot
size_t size_t
state_product::hash() const state_product::hash() const
{ {
// We assume that size_t has at least 32bits. // We assume that size_t is 32-bit wide.
return (left_->hash() << 16) + (right_->hash() & 0xFFFF); return wang32_hash(left_->hash()) ^ wang32_hash(right_->hash());
} }
state_product* state_product*
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "tgbatba.hh" #include "tgbatba.hh"
#include "bddprint.hh" #include "bddprint.hh"
#include "ltlast/constant.hh" #include "ltlast/constant.hh"
#include "misc/hashfunc.hh"
namespace spot namespace spot
{ {
...@@ -30,7 +31,7 @@ namespace spot ...@@ -30,7 +31,7 @@ namespace spot
{ {
/// \brief A state for spot::tgba_tba_proxy. /// \brief A state for spot::tgba_tba_proxy.
/// ///
/// This state is in fact a pair of state: the state from the tgba /// This state is in fact a pair of states: the state from the tgba
/// automaton, and a state of the "counter" (we use a pointer /// automaton, and a state of the "counter" (we use a pointer
/// to the position in the cycle_acc_ list). /// to the position in the cycle_acc_ list).
class state_tba_proxy: public state class state_tba_proxy: public state
...@@ -88,9 +89,7 @@ namespace spot ...@@ -88,9 +89,7 @@ namespace spot
virtual size_t virtual size_t
hash() const hash() const
{ {
// We expect to have many more states than acceptance conditions. return wang32_hash(s_->hash()) ^ wang32_hash(acc_->id());
// Hence we keep only 8 bits for acceptance conditions.
return (s_->hash() << 8) + (acc_->id() & 0xFF);
} }
virtual virtual
......
Supports Markdown
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