#include "expr/expr_iomanip.h"
#include "options/language.h"
#include "options/set_language.h"
+#include "util/hash.h"
#include "util/utility.h"
namespace CVC4 {
return node.getId();
}
-struct TNodePairHashFunction {
- size_t operator()(const std::pair<CVC4::TNode, CVC4::TNode>& pair ) const {
- TNode n1 = pair.first;
- TNode n2 = pair.second;
-
- return (size_t) (n1.getId() * 0x9e3779b9 + n2.getId());
- }
-};/* struct TNodePairHashFunction */
+using TNodePairHashFunction =
+ PairHashFunction<TNode, TNode, TNodeHashFunction, TNodeHashFunction>;
template <bool ref_count>
inline size_t NodeTemplate<ref_count>::getNumChildren() const {
#include <vector>
#include "expr/node.h"
+#include "util/hash.h"
#include "util/statistics_registry.h"
namespace CVC4 {
uint32_t d_citeEqConstApplications;
typedef std::pair<Node, Node> NodePair;
- struct NodePairHashFunction {
- size_t operator () (const NodePair& pair) const {
- size_t hash = 0;
- hash = 0x9e3779b9 + NodeHashFunction().operator()(pair.first);
- hash ^= 0x9e3779b9 + NodeHashFunction().operator()(pair.second) + (hash << 6) + (hash >> 2);
- return hash;
- }
- };/* struct ITESimplifier::NodePairHashFunction */
+ using NodePairHashFunction =
+ PairHashFunction<Node, Node, NodeHashFunction, NodeHashFunction>;
typedef std::unordered_map<NodePair, Node, NodePairHashFunction> NodePairMap;
NodePairMap d_constantIteEqualsConstantCache;
NodePairMap d_replaceOverCache;
#include "theory/theory.h"
#include "theory/uf/equality_engine.h"
#include "theory/valuation.h"
+#include "util/hash.h"
#include "util/statistics_registry.h"
#include "util/unsafe_interrupt_exception.h"
NodeHashFunction hashFunction;
// Hash doesn't take into account the timestamp
size_t operator()(const NodeTheoryPair& pair) const {
- return hashFunction(pair.node)*0x9e3779b9 + pair.theory;
+ uint64_t hash = fnv1a::fnv1a_64(NodeHashFunction()(pair.node));
+ return static_cast<size_t>(fnv1a::fnv1a_64(pair.theory, hash));
}
};/* struct NodeTheoryPairHashFunction */
#include "cvc4_private.h"
+#ifndef __CVC4__THEORY__UF__EQUALITY_ENGINE_TYPES_H
+#define __CVC4__THEORY__UF__EQUALITY_ENGINE_TYPES_H
+
#include <string>
#include <iostream>
#include <sstream>
+#include "util/hash.h"
+
namespace CVC4 {
namespace theory {
namespace eq {
/** A pair of ids */
typedef std::pair<EqualityNodeId, EqualityNodeId> EqualityPair;
-
-struct EqualityPairHashFunction {
- size_t operator () (const EqualityPair& pair) const {
- size_t hash = 0;
- hash = 0x9e3779b9 + pair.first;
- hash ^= 0x9e3779b9 + pair.second + (hash << 6) + (hash >> 2);
- return hash;
- }
-};
+using EqualityPairHashFunction =
+ PairHashFunction<EqualityNodeId, EqualityNodeId>;
enum FunctionApplicationType {
/** This application is an equality a = b */
} // namespace eq
} // namespace theory
} // namespace CVC4
+
+#endif /* __CVC4__THEORY__UF__EQUALITY_ENGINE_TYPES_H */