mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
resolved conflicts
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
a1277a57ae
23 changed files with 124 additions and 182 deletions
|
@ -20,6 +20,7 @@ Revision History:
|
|||
#define _HASH_H_
|
||||
|
||||
#include<algorithm>
|
||||
#include"util.h"
|
||||
|
||||
#ifndef __fallthrough
|
||||
#define __fallthrough
|
||||
|
@ -142,6 +143,11 @@ struct size_t_hash {
|
|||
unsigned operator()(size_t x) const { return static_cast<unsigned>(x); }
|
||||
};
|
||||
|
||||
struct uint64_hash {
|
||||
typedef uint64 data;
|
||||
unsigned operator()(uint64 x) const { return static_cast<unsigned>(x); }
|
||||
};
|
||||
|
||||
struct bool_hash {
|
||||
typedef bool data;
|
||||
unsigned operator()(bool x) const { return static_cast<unsigned>(x); }
|
||||
|
|
|
@ -432,24 +432,29 @@ typedef svector<unsigned> unsigned_vector;
|
|||
typedef svector<char> char_vector;
|
||||
typedef svector<double> double_vector;
|
||||
|
||||
template<typename Hash>
|
||||
struct vector_hash {
|
||||
template<typename Hash, typename Vec>
|
||||
struct vector_hash_tpl {
|
||||
Hash m_hash;
|
||||
typedef vector<typename Hash::data> data;
|
||||
typedef Vec data;
|
||||
|
||||
unsigned operator()(data const& v, unsigned idx) const { return m_hash(v[idx]); }
|
||||
|
||||
vector_hash(Hash const& h = Hash()):m_hash(h) {}
|
||||
vector_hash_tpl(Hash const& h = Hash()):m_hash(h) {}
|
||||
|
||||
unsigned operator()(data const& v) const {
|
||||
if (v.empty()) {
|
||||
return 778;
|
||||
}
|
||||
return get_composite_hash<data, default_kind_hash_proc<data>, vector_hash>(v, v.size());
|
||||
return get_composite_hash<data, default_kind_hash_proc<data>, vector_hash_tpl>(v, v.size());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template<typename Hash>
|
||||
struct vector_hash : public vector_hash_tpl<Hash, vector<typename Hash::data> > {};
|
||||
|
||||
template<typename Hash>
|
||||
struct svector_hash : public vector_hash_tpl<Hash, svector<typename Hash::data> > {};
|
||||
|
||||
|
||||
#endif /* _VECTOR_H_ */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue