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>
* 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,
extracted from...
* src/evtgba/product.cc (evtgba_product_state::hash): ... here.
......
......@@ -22,6 +22,7 @@
#include "tgbaproduct.hh"
#include <string>
#include <cassert>
#include "misc/hashfunc.hh"
namespace spot
{
......@@ -56,8 +57,8 @@ namespace spot
size_t
state_product::hash() const
{
// We assume that size_t has at least 32bits.
return (left_->hash() << 16) + (right_->hash() & 0xFFFF);
// We assume that size_t is 32-bit wide.
return wang32_hash(left_->hash()) ^ wang32_hash(right_->hash());
}
state_product*
......
......@@ -23,6 +23,7 @@
#include "tgbatba.hh"
#include "bddprint.hh"
#include "ltlast/constant.hh"
#include "misc/hashfunc.hh"
namespace spot
{
......@@ -30,7 +31,7 @@ namespace spot
{
/// \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
/// to the position in the cycle_acc_ list).
class state_tba_proxy: public state
......@@ -88,9 +89,7 @@ namespace spot
virtual size_t
hash() const
{
// We expect to have many more states than acceptance conditions.
// Hence we keep only 8 bits for acceptance conditions.
return (s_->hash() << 8) + (acc_->id() & 0xFF);
return wang32_hash(s_->hash()) ^ wang32_hash(acc_->id());
}
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