3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

remove unneeded creation of tmp mpz_manager

This commit is contained in:
Nuno Lopes 2018-07-09 10:52:27 +01:00
parent 6f7271a5e8
commit 009708ed07
2 changed files with 14 additions and 12 deletions

View file

@ -2629,17 +2629,15 @@ namespace algebraic_numbers {
}
else if (a.is_basic()) {
mpq const & v = basic_value(a);
scoped_mpz neg_n(qm());
mpz neg_n;
qm().set(neg_n, v.numerator());
qm().neg(neg_n);
unsynch_mpz_manager zmgr;
// FIXME: remove these copies
mpz coeffs[2] = { zmgr.dup(neg_n.get()), zmgr.dup(v.denominator()) };
mpz coeffs[2] = { std::move(neg_n), qm().dup(v.denominator()) };
out << "(";
upm().display(out, 2, coeffs, "#");
out << ", 1)"; // first root of the polynomial d*# - n
zmgr.del(coeffs[0]);
zmgr.del(coeffs[1]);
qm().del(coeffs[0]);
qm().del(coeffs[1]);
}
else {
algebraic_cell * c = a.to_algebraic();
@ -2679,17 +2677,15 @@ namespace algebraic_numbers {
}
else if (a.is_basic()) {
mpq const & v = basic_value(a);
scoped_mpz neg_n(qm());
mpz neg_n;
qm().set(neg_n, v.numerator());
qm().neg(neg_n);
unsynch_mpz_manager zmgr;
// FIXME: remove these copies
mpz coeffs[2] = { zmgr.dup(neg_n.get()), zmgr.dup(v.denominator()) };
mpz coeffs[2] = { std::move(neg_n), qm().dup(v.denominator()) };
out << "(root-obj ";
upm().display_smt2(out, 2, coeffs, "x");
out << " 1)"; // first root of the polynomial d*# - n
zmgr.del(coeffs[0]);
zmgr.del(coeffs[1]);
qm().del(coeffs[0]);
qm().del(coeffs[1]);
}
else {
algebraic_cell * c = a.to_algebraic();