diff options
| author | Julian Andres Klode <jak@debian.org> | 2025-12-21 22:56:13 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-01-05 21:20:24 +0000 |
| commit | 982b94ba9d7615d2b5a6420411c3d41356fdf19a (patch) | |
| tree | f1c4a6edba5104bbe1536a449100023f5cfa6923 /apt-pkg/solver3.h | |
| parent | 1700acb919ce9c495db4dce4003f73751cc9c1f2 (diff) | |
solver3: Implement value(Lit) and use it
Diffstat (limited to 'apt-pkg/solver3.h')
| -rw-r--r-- | apt-pkg/solver3.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h index 8310bb1c5..235717d86 100644 --- a/apt-pkg/solver3.h +++ b/apt-pkg/solver3.h @@ -79,10 +79,12 @@ using FastContiguousCacheMap = ContiguousCacheMap<K, V, true>; */ class Solver { + public: enum class Decision : uint16_t; - enum class Hint : uint16_t; struct Var; struct Lit; + + private: struct CompareProviders3; struct State; struct Clause; @@ -277,6 +279,7 @@ class Solver return static_cast<depth_type>(choices.size()); } inline Var bestReason(Clause const *clause, Var var) const; + inline Decision value(Lit lit) const; public: // \brief Create a new decision level. @@ -583,3 +586,17 @@ constexpr APT::Solver::Lit APT::Solver::Var::operator~() const { return ~Lit(*this); } + +inline APT::Solver::Decision operator~(APT::Solver::Decision decision) +{ + switch (decision) + { + case APT::Solver::Decision::NONE: + return APT::Solver::Decision::NONE; + case APT::Solver::Decision::MUST: + return APT::Solver::Decision::MUSTNOT; + case APT::Solver::Decision::MUSTNOT: + return APT::Solver::Decision::MUST; + } + abort(); +} |
