3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-11-09 23:52:02 +00:00

Use parity helper functions

This commit is contained in:
Jakob Rath 2023-02-08 15:11:39 +01:00
parent bf03886a87
commit a0f5386bdd
5 changed files with 33 additions and 40 deletions

View file

@ -872,10 +872,10 @@ namespace polysat {
auto& m = p.manager();
unsigned N = m.power_of_2();
if (p.is_val())
return p.val() == 0 ? N : p.val().trailing_zeros();
return p.val().parity(N);
if (s.try_eval(p, val)) {
unsigned k = val == 0 ? N : val.trailing_zeros();
unsigned k = val.parity(N);
if (k > 0)
explain.push_back(s.parity_at_least(p, k));
return k;
@ -910,10 +910,10 @@ namespace polysat {
unsigned N = m.power_of_2();
rational val;
if (p.is_val())
return p.val() == 0 ? N : p.val().trailing_zeros();
return p.val().parity(N);
if (s.try_eval(p, val)) {
unsigned k = val == 0 ? N : val.trailing_zeros();
unsigned k = val.parity(N);
if (k != N)
explain.push_back(s.parity_at_most(p, k));
return k;