* src/misc/hashfunc.hh (knuth32_hash): New function.
* src/misc/hash.hh (ptr_hash): Use knuth32_hash. * src/tgba/tgbabddconcretefactory.hh (tgba_bdd_concrete_factory): Use ltl::formula_ptr_hash for acc_map_.
This commit is contained in:
parent
9063c5abb4
commit
814ec7c2d0
4 changed files with 26 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -45,6 +45,20 @@ namespace spot
|
|||
key ^= (key >> 16);
|
||||
return key;
|
||||
}
|
||||
|
||||
/// \brief Knuth's Multiplicative hash function.
|
||||
///
|
||||
/// This function is suitable for hashing values whose
|
||||
/// high order bits do not vary much (ex. addresses of
|
||||
/// memory objects). Prefer spot::wang32_hash() otherwise.
|
||||
/// http://www.concentric.net/~Ttwang/tech/addrhash.htm
|
||||
inline size_t
|
||||
knuth32_hash(size_t key)
|
||||
{
|
||||
// 2654435761 is the golden ratio of 2^32. The right shift of 3
|
||||
// bits assumes that all objects are aligned on a 8 byte boundary.
|
||||
return (key >> 3) * 2654435761U;
|
||||
}
|
||||
/// @}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue