mirror of
https://github.com/Z3Prover/z3
synced 2026-05-04 09:25:15 +00:00
Fix syntax errors in mpz.h
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
This commit is contained in:
parent
ac1bef0053
commit
cb3b8603eb
1 changed files with 8 additions and 10 deletions
|
|
@ -136,7 +136,6 @@ protected:
|
||||||
friend class mpz_stack;
|
friend class mpz_stack;
|
||||||
public:
|
public:
|
||||||
mpz(int v = 0) noexcept : m_value(static_cast<uintptr_t>(static_cast<intptr_t>(v)) << 1) {}
|
mpz(int v = 0) noexcept : m_value(static_cast<uintptr_t>(static_cast<intptr_t>(v)) << 1) {}
|
||||||
}
|
|
||||||
|
|
||||||
mpz(mpz_type* ptr) noexcept {
|
mpz(mpz_type* ptr) noexcept {
|
||||||
SASSERT(ptr);
|
SASSERT(ptr);
|
||||||
|
|
@ -155,15 +154,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(int v) {
|
void set(int v) {
|
||||||
if (is_small()) {
|
m_value = static_cast<uintptr_t>(static_cast<intptr_t>(v)) << 1;
|
||||||
m_value = static_cast<uintptr_t>(static_cast<intptr_t>(v)) << 1;
|
}
|
||||||
} else {
|
|
||||||
bool is_negative = v < 0;
|
void swap(mpz & other) noexcept {
|
||||||
c.set_sign(is_negative ? -1 : 1);
|
std::swap(m_value, other.m_value);
|
||||||
auto *p = ptr();
|
|
||||||
p->m_digits[0] = static_cast<digit_t>(is_negative ? -v : v);
|
|
||||||
p->m_size = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_small() const {
|
inline bool is_small() const {
|
||||||
|
|
@ -598,6 +593,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(mpz & a, int val) {
|
void set(mpz & a, int val) {
|
||||||
|
if (!is_small(a)) {
|
||||||
|
deallocate(a);
|
||||||
|
}
|
||||||
a.set(val);
|
a.set(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue