From d663720936b0b873c917fc3fce9999f069bea0f1 Mon Sep 17 00:00:00 2001 From: Alex Ozdemir Date: Fri, 5 Apr 2019 10:03:05 -0700 Subject: [PATCH] SatClauseSetHashFunction (#2916) * SatClauseHashFunction Added to the same file as SatLiteralHashFunction. * clang-format Thanks Andres! --- src/prop/sat_solver_types.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/prop/sat_solver_types.h b/src/prop/sat_solver_types.h index 68fd04b1f..f1fd6233e 100644 --- a/src/prop/sat_solver_types.h +++ b/src/prop/sat_solver_types.h @@ -26,6 +26,7 @@ #include #include +#include #include namespace CVC4 { @@ -167,6 +168,21 @@ struct SatLiteralHashFunction { */ typedef std::vector SatClause; +struct SatClauseSetHashFunction +{ + inline size_t operator()( + const std::unordered_set& clause) + const + { + size_t acc = 0; + for (const auto& l : clause) + { + acc ^= l.hash(); + } + return acc; + } +}; + /** * Each object in the SAT solver, such as as variables and clauses, can be assigned a life span, * so that the SAT solver can (or should) remove them when the lifespan is over. -- 2.30.2