mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
call it data instead of c_ptr for approaching C++11 std::vector convention.
This commit is contained in:
parent
524dcd35f9
commit
4a6083836a
456 changed files with 2802 additions and 2802 deletions
|
@ -69,7 +69,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
typedef T data;
|
||||
typedef T data_t;
|
||||
typedef T * iterator;
|
||||
typedef const T * const_iterator;
|
||||
|
||||
|
@ -181,8 +181,8 @@ public:
|
|||
return m_data + size();
|
||||
}
|
||||
|
||||
T const * c_ptr() const { return m_data; }
|
||||
T * c_ptr() { return m_data; }
|
||||
T const * data() const { return m_data; }
|
||||
T * data() { return m_data; }
|
||||
|
||||
void swap(array & other) {
|
||||
std::swap(m_data, other.m_data);
|
||||
|
|
|
@ -69,7 +69,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
typedef T data;
|
||||
typedef T data_t;
|
||||
typedef T * iterator;
|
||||
typedef const T * const_iterator;
|
||||
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
return m_buffer[m_pos - 1];
|
||||
}
|
||||
|
||||
T * c_ptr() const {
|
||||
T * data() const {
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ public:
|
|||
}
|
||||
|
||||
void append(const buffer& source) {
|
||||
append(source.size(), source.c_ptr());
|
||||
append(source.size(), source.data());
|
||||
}
|
||||
|
||||
T & operator[](unsigned idx) {
|
||||
|
|
|
@ -85,7 +85,7 @@ void print_container(const T & cont, std::ostream & out) {
|
|||
|
||||
template<class T, class M>
|
||||
void print_container(const ref_vector<T,M> & cont, std::ostream & out) {
|
||||
print_container(cont.c_ptr(), cont.c_ptr() + cont.size(), out);
|
||||
print_container(cont.data(), cont.data() + cont.size(), out);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
|
|
@ -129,33 +129,33 @@ template<typename Composite>
|
|||
struct default_kind_hash_proc { unsigned operator()(Composite const & c) const { return 17; } };
|
||||
|
||||
struct int_hash {
|
||||
typedef int data;
|
||||
typedef int data_t;
|
||||
unsigned operator()(int x) const { return static_cast<unsigned>(x); }
|
||||
};
|
||||
|
||||
struct unsigned_hash {
|
||||
typedef unsigned data;
|
||||
typedef unsigned data_t;
|
||||
unsigned operator()(unsigned x) const { return x; }
|
||||
};
|
||||
|
||||
struct size_t_hash {
|
||||
typedef size_t data;
|
||||
typedef size_t data_t;
|
||||
unsigned operator()(size_t x) const { return static_cast<unsigned>(x); }
|
||||
};
|
||||
|
||||
struct uint64_hash {
|
||||
typedef uint64_t data;
|
||||
typedef uint64_t data_t;
|
||||
unsigned operator()(uint64_t x) const { return static_cast<unsigned>(x); }
|
||||
};
|
||||
|
||||
struct bool_hash {
|
||||
typedef bool data;
|
||||
typedef bool data_t;
|
||||
unsigned operator()(bool x) const { return static_cast<unsigned>(x); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct obj_hash {
|
||||
typedef T data;
|
||||
typedef T data_t;
|
||||
unsigned operator()(const T & e) const {
|
||||
return e.hash();
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ struct obj_hash {
|
|||
|
||||
template<typename T>
|
||||
struct obj_ptr_hash {
|
||||
typedef T * data;
|
||||
typedef T * data_t;
|
||||
unsigned operator()(T * a) const {
|
||||
return a->hash();
|
||||
}
|
||||
|
@ -171,8 +171,8 @@ struct obj_ptr_hash {
|
|||
|
||||
template<typename T1, typename T2>
|
||||
struct obj_ptr_pair_hash {
|
||||
typedef std::pair<T1*, T2*> data;
|
||||
unsigned operator()(data const & d) const {
|
||||
typedef std::pair<T1*, T2*> data_t;
|
||||
unsigned operator()(data_t const & d) const {
|
||||
return combine_hash(d.first->hash(), d.second->hash());
|
||||
}
|
||||
};
|
||||
|
@ -197,22 +197,22 @@ template<typename Hash1, typename Hash2, typename Hash3>
|
|||
struct triple_hash : private Hash1 {
|
||||
Hash2 m_hash2;
|
||||
Hash3 m_hash3;
|
||||
typedef triple<typename Hash1::data, typename Hash2::data, typename Hash3::data> data;
|
||||
typedef triple<typename Hash1::data_t, typename Hash2::data_t, typename Hash3::data> data_t;
|
||||
triple_hash(Hash1 const & h1 = Hash1(), Hash2 const & h2 = Hash2(), Hash3 const & h3 = Hash3()):
|
||||
Hash1(h1),
|
||||
m_hash2(h2),
|
||||
m_hash3(h3) {
|
||||
}
|
||||
|
||||
unsigned operator()(std::pair<typename Hash1::data, typename Hash2::data> const & p) const {
|
||||
unsigned operator()(std::pair<typename Hash1::data_t, typename Hash2::data_t> const & p) const {
|
||||
return combine_hash(combine_hash(Hash1::operator()(p.first), m_hash2.operator()(p.second)), m_hash3.operator()(p.third));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T1, typename T2, typename T3>
|
||||
struct obj_ptr_triple_hash {
|
||||
typedef triple<T1*, T2*, T3*> data;
|
||||
unsigned operator()(data const & d) const {
|
||||
typedef triple<T1*, T2*, T3*> data_t;
|
||||
unsigned operator()(data_t const & d) const {
|
||||
return combine_hash(combine_hash(d.first->hash(), d.second->hash()), d.third->hash());
|
||||
}
|
||||
};
|
||||
|
@ -220,13 +220,13 @@ struct obj_ptr_triple_hash {
|
|||
template<typename Hash1, typename Hash2>
|
||||
struct pair_hash : private Hash1 {
|
||||
Hash2 m_hash2;
|
||||
typedef std::pair<typename Hash1::data, typename Hash2::data> data;
|
||||
typedef std::pair<typename Hash1::data_t, typename Hash2::data_t> data_t;
|
||||
pair_hash(Hash1 const & h1 = Hash1(), Hash2 const & h2 = Hash2()):
|
||||
Hash1(h1),
|
||||
m_hash2(h2) {
|
||||
}
|
||||
|
||||
unsigned operator()(std::pair<typename Hash1::data, typename Hash2::data> const & p) const {
|
||||
unsigned operator()(std::pair<typename Hash1::data_t, typename Hash2::data_t> const & p) const {
|
||||
return combine_hash(Hash1::operator()(p.first), m_hash2.operator()(p.second));
|
||||
}
|
||||
};
|
||||
|
@ -238,7 +238,7 @@ inline unsigned get_ptr_hash(T * ptr) {
|
|||
|
||||
template<typename T>
|
||||
struct ptr_hash {
|
||||
typedef T * data;
|
||||
typedef T * data_t;
|
||||
unsigned operator()(T * ptr) const {
|
||||
return get_ptr_hash(ptr);
|
||||
}
|
||||
|
|
|
@ -345,8 +345,8 @@ void mpff_manager::set_core(mpff & n, mpz_manager<SYNCH> & m, mpz const & v) {
|
|||
TRACE("mpff", tout << "w words: "; for (unsigned i = 0; i < w.size(); i++) tout << w[i] << " "; tout << "\n";);
|
||||
unsigned w_sz = w.size();
|
||||
SASSERT(w_sz >= m_precision);
|
||||
unsigned num_leading_zeros = nlz(w_sz, w.c_ptr());
|
||||
shl(w_sz, w.c_ptr(), num_leading_zeros, w_sz, w.c_ptr());
|
||||
unsigned num_leading_zeros = nlz(w_sz, w.data());
|
||||
shl(w_sz, w.data(), num_leading_zeros, w_sz, w.data());
|
||||
unsigned * s = sig(n);
|
||||
unsigned i = m_precision;
|
||||
unsigned j = w_sz;
|
||||
|
@ -685,7 +685,7 @@ void mpff_manager::add_sub(bool is_sub, mpff const & a, mpff const & b, mpff & c
|
|||
// Make sure that a and b have the same exponent.
|
||||
if (exp_a > exp_b) {
|
||||
unsigned shift = (unsigned)exp_a - (unsigned)exp_b;
|
||||
n_sig_b = m_buffers[0].c_ptr();
|
||||
n_sig_b = m_buffers[0].data();
|
||||
shr(m_precision, sig_b, shift, m_precision, n_sig_b);
|
||||
if (sgn_b != m_to_plus_inf && has_one_at_first_k_bits(m_precision, sig_b, shift)) {
|
||||
// Precision was lost when normalizing the significand.
|
||||
|
@ -702,7 +702,7 @@ void mpff_manager::add_sub(bool is_sub, mpff const & a, mpff const & b, mpff & c
|
|||
// Compute c
|
||||
if (sgn_a == sgn_b) {
|
||||
c.m_sign = sgn_a;
|
||||
unsigned * sig_r = m_buffers[1].c_ptr();
|
||||
unsigned * sig_r = m_buffers[1].data();
|
||||
size_t r_sz;
|
||||
m_mpn_manager.add(sig_a, m_precision, n_sig_b, m_precision, sig_r, m_precision + 1, &r_sz);
|
||||
SASSERT(r_sz <= m_precision + 1);
|
||||
|
@ -796,7 +796,7 @@ void mpff_manager::mul(mpff const & a, mpff const & b, mpff & c) {
|
|||
int64_t exp_b = b.m_exponent;
|
||||
int64_t exp_c = exp_a + exp_b;
|
||||
// store result in m_buffers[0]
|
||||
unsigned * r = m_buffers[0].c_ptr();
|
||||
unsigned * r = m_buffers[0].data();
|
||||
m_mpn_manager.mul(sig(a), m_precision, sig(b), m_precision, r);
|
||||
// r has 2*m_precision_bits bits
|
||||
unsigned num_leading_zeros = nlz(m_precision*2, r);
|
||||
|
@ -854,10 +854,10 @@ void mpff_manager::div(mpff const & a, mpff const & b, mpff & c) {
|
|||
exp_c -= m_precision_bits; // we will multiplying (shifting) a by 2^m_precision_bits.
|
||||
// copy a to buffer 0, and shift by m_precision_bits
|
||||
to_buffer_shifting(0, a);
|
||||
unsigned * _a = m_buffers[0].c_ptr();
|
||||
unsigned * q = m_buffers[1].c_ptr();
|
||||
unsigned * _a = m_buffers[0].data();
|
||||
unsigned * q = m_buffers[1].data();
|
||||
unsigned q_sz = m_precision + 1; // 2*m_precision - m_precision + 1
|
||||
unsigned * r = m_buffers[2].c_ptr();
|
||||
unsigned * r = m_buffers[2].data();
|
||||
unsigned r_sz = m_precision;
|
||||
SASSERT(!::is_zero(2*m_precision, _a));
|
||||
SASSERT(!::is_zero(m_precision, sig(b)));
|
||||
|
@ -1094,7 +1094,7 @@ void mpff_manager::to_mpz_core(mpff const & n, mpz_manager<SYNCH> & m, mpz & t)
|
|||
if (exp < 0) {
|
||||
SASSERT(exp > -static_cast<int>(m_precision_bits));
|
||||
to_buffer(0, n);
|
||||
unsigned * b = m_buffers[0].c_ptr();
|
||||
unsigned * b = m_buffers[0].data();
|
||||
shr(m_precision, b, -exp, m_precision, b);
|
||||
m.set_digits(t, m_precision, b);
|
||||
}
|
||||
|
@ -1127,7 +1127,7 @@ void mpff_manager::to_mpq_core(mpff const & n, mpq_manager<SYNCH> & m, mpq & t)
|
|||
TRACE("mpff_to_mpq", tout << "to_mpq: "; display(tout, n); tout << "\nexp: " << exp << "\n";);
|
||||
if (exp < 0 && exp > -static_cast<int>(m_precision_bits) && !has_one_at_first_k_bits(m_precision, sig(n), -n.m_exponent)) {
|
||||
to_buffer(0, n);
|
||||
unsigned * b = m_buffers[0].c_ptr();
|
||||
unsigned * b = m_buffers[0].data();
|
||||
shr(m_precision, b, -exp, m_precision, b);
|
||||
m.set(t, m_precision, b);
|
||||
}
|
||||
|
@ -1185,7 +1185,7 @@ void mpff_manager::display(std::ostream & out, mpff const & n) const {
|
|||
out << "-";
|
||||
to_buffer_ext(0, n);
|
||||
svector<unsigned> & u_buffer = const_cast<mpff_manager*>(this)->m_buffers[0];
|
||||
int num_trailing_zeros = ntz(m_precision, u_buffer.c_ptr());
|
||||
int num_trailing_zeros = ntz(m_precision, u_buffer.data());
|
||||
int shift = 0;
|
||||
int64_t exp = n.m_exponent; // use int64_t to avoid -INT_MIN == INT_MIN issue
|
||||
if (exp < 0) {
|
||||
|
@ -1199,9 +1199,9 @@ void mpff_manager::display(std::ostream & out, mpff const & n) const {
|
|||
}
|
||||
}
|
||||
if (shift > 0)
|
||||
shr(m_precision, u_buffer.c_ptr(), shift, u_buffer.c_ptr());
|
||||
shr(m_precision, u_buffer.data(), shift, u_buffer.data());
|
||||
sbuffer<char, 1024> str_buffer(11*m_precision, 0);
|
||||
out << m_mpn_manager.to_string(u_buffer.c_ptr(), m_precision, str_buffer.begin(), str_buffer.size());
|
||||
out << m_mpn_manager.to_string(u_buffer.data(), m_precision, str_buffer.begin(), str_buffer.size());
|
||||
if (exp > 0) {
|
||||
if (exp <= 63) {
|
||||
uint64_t _exp = 1;
|
||||
|
@ -1252,9 +1252,9 @@ void mpff_manager::display_decimal(std::ostream & out, mpff const & n, unsigned
|
|||
unsigned * s = sig(n);
|
||||
for (unsigned i = 0; i < m_precision; i++)
|
||||
buffer.push_back(s[i]);
|
||||
shr(buffer.size(), buffer.c_ptr(), shift, buffer.size(), buffer.c_ptr());
|
||||
shr(buffer.size(), buffer.data(), shift, buffer.size(), buffer.data());
|
||||
sbuffer<char, 1024> str_buffer(11*buffer.size(), 0);
|
||||
out << m_mpn_manager.to_string(buffer.c_ptr(), buffer.size(), str_buffer.begin(), str_buffer.size());
|
||||
out << m_mpn_manager.to_string(buffer.data(), buffer.size(), str_buffer.begin(), str_buffer.size());
|
||||
}
|
||||
else {
|
||||
sbuffer<unsigned, 1024> buffer1, buffer2;
|
||||
|
@ -1277,19 +1277,19 @@ void mpff_manager::display_decimal(std::ostream & out, mpff const & n, unsigned
|
|||
sbuffer<unsigned, 1024> pw_buffer;
|
||||
pw_buffer.resize(num_words, 0);
|
||||
pw_buffer[0] = 1;
|
||||
shl(num_words, pw_buffer.c_ptr(), static_cast<unsigned>(exp), num_words, pw_buffer.c_ptr());
|
||||
shl(num_words, pw_buffer.data(), static_cast<unsigned>(exp), num_words, pw_buffer.data());
|
||||
if (num_words > m_precision) {
|
||||
out << "0";
|
||||
}
|
||||
else {
|
||||
m_mpn_manager.div(buffer1.c_ptr(), m_precision,
|
||||
pw_buffer.c_ptr(), num_words,
|
||||
buffer3.c_ptr(),
|
||||
buffer2.c_ptr());
|
||||
m_mpn_manager.div(buffer1.data(), m_precision,
|
||||
pw_buffer.data(), num_words,
|
||||
buffer3.data(),
|
||||
buffer2.data());
|
||||
sbuffer<char, 1024> str_buffer(11*buffer3.size(), 0);
|
||||
out << m_mpn_manager.to_string(buffer3.c_ptr(), buffer3.size(), str_buffer.begin(), str_buffer.size());
|
||||
SASSERT(!::is_zero(buffer2.size(), buffer2.c_ptr())); // otherwise n is an integer
|
||||
::copy(buffer2.size(), buffer2.c_ptr(), buffer1.size(), buffer1.c_ptr());
|
||||
out << m_mpn_manager.to_string(buffer3.data(), buffer3.size(), str_buffer.begin(), str_buffer.size());
|
||||
SASSERT(!::is_zero(buffer2.size(), buffer2.data())); // otherwise n is an integer
|
||||
::copy(buffer2.size(), buffer2.data(), buffer1.size(), buffer1.data());
|
||||
}
|
||||
out << ".";
|
||||
// buffer1 contain the fractional part
|
||||
|
@ -1304,7 +1304,7 @@ void mpff_manager::display_decimal(std::ostream & out, mpff const & n, unsigned
|
|||
return;
|
||||
}
|
||||
i = i + 1;
|
||||
m_mpn_manager.mul(buffer1.c_ptr(), sz1, &ten, 1, buffer2.c_ptr());
|
||||
m_mpn_manager.mul(buffer1.data(), sz1, &ten, 1, buffer2.data());
|
||||
unsigned sz2 = sz1 + 1;
|
||||
while (sz2 > 0 && buffer2[sz2-1] == 0)
|
||||
--sz2;
|
||||
|
@ -1312,19 +1312,19 @@ void mpff_manager::display_decimal(std::ostream & out, mpff const & n, unsigned
|
|||
if (num_words > sz2) {
|
||||
out << "0";
|
||||
sz1 = sz2;
|
||||
::copy(sz2, buffer2.c_ptr(), sz1, buffer1.c_ptr());
|
||||
SASSERT(sz1 == 0 || !::is_zero(sz1, buffer1.c_ptr()));
|
||||
::copy(sz2, buffer2.data(), sz1, buffer1.data());
|
||||
SASSERT(sz1 == 0 || !::is_zero(sz1, buffer1.data()));
|
||||
}
|
||||
else {
|
||||
m_mpn_manager.div(buffer2.c_ptr(), sz2,
|
||||
pw_buffer.c_ptr(), num_words,
|
||||
buffer3.c_ptr(),
|
||||
buffer1.c_ptr());
|
||||
m_mpn_manager.div(buffer2.data(), sz2,
|
||||
pw_buffer.data(), num_words,
|
||||
buffer3.data(),
|
||||
buffer1.data());
|
||||
out << buffer3[0];
|
||||
sz1 = num_words;
|
||||
while (sz1 > 0 && buffer1[sz1-1] == 0)
|
||||
--sz1;
|
||||
SASSERT(sz1 == 0 || !::is_zero(sz1, buffer1.c_ptr()));
|
||||
SASSERT(sz1 == 0 || !::is_zero(sz1, buffer1.data()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1335,7 +1335,7 @@ void mpff_manager::display_smt2(std::ostream & out, mpff const & n, bool decimal
|
|||
out << "(- ";
|
||||
to_buffer_ext(0, n);
|
||||
svector<unsigned> & u_buffer = const_cast<mpff_manager*>(this)->m_buffers[0];
|
||||
int num_trailing_zeros = ntz(m_precision, u_buffer.c_ptr());
|
||||
int num_trailing_zeros = ntz(m_precision, u_buffer.data());
|
||||
int shift = 0;
|
||||
int64_t exp = n.m_exponent;
|
||||
if (exp < 0) {
|
||||
|
@ -1349,7 +1349,7 @@ void mpff_manager::display_smt2(std::ostream & out, mpff const & n, bool decimal
|
|||
}
|
||||
}
|
||||
if (shift > 0)
|
||||
shr(m_precision, u_buffer.c_ptr(), shift, u_buffer.c_ptr());
|
||||
shr(m_precision, u_buffer.data(), shift, u_buffer.data());
|
||||
|
||||
if (exp > 0)
|
||||
out << "(* ";
|
||||
|
@ -1357,7 +1357,7 @@ void mpff_manager::display_smt2(std::ostream & out, mpff const & n, bool decimal
|
|||
out << "(/ ";
|
||||
|
||||
sbuffer<char, 1024> str_buffer(11*m_precision, 0);
|
||||
out << m_mpn_manager.to_string(u_buffer.c_ptr(), m_precision, str_buffer.begin(), str_buffer.size());
|
||||
out << m_mpn_manager.to_string(u_buffer.data(), m_precision, str_buffer.begin(), str_buffer.size());
|
||||
if (decimal) out << ".0";
|
||||
|
||||
if (exp != 0) {
|
||||
|
|
|
@ -122,7 +122,7 @@ class mpff_manager {
|
|||
mpff m_one;
|
||||
mpn_manager m_mpn_manager;
|
||||
|
||||
unsigned * sig(mpff const & n) const { return m_significands.c_ptr() + (n.m_sig_idx * m_precision); }
|
||||
unsigned * sig(mpff const & n) const { return m_significands.data() + (n.m_sig_idx * m_precision); }
|
||||
|
||||
void ensure_capacity(unsigned sig_idx) {
|
||||
while (sig_idx >= m_capacity)
|
||||
|
|
|
@ -264,7 +264,7 @@ void mpfx_manager::set_core(mpfx & n, mpz_manager<SYNCH> & m, mpz const & v) {
|
|||
unsigned * w = words(n);
|
||||
for (unsigned i = 0; i < m_frac_part_sz; i++)
|
||||
w[i] = 0;
|
||||
::copy(sz, m_tmp_digits.c_ptr(), m_int_part_sz, w + m_frac_part_sz);
|
||||
::copy(sz, m_tmp_digits.data(), m_int_part_sz, w + m_frac_part_sz);
|
||||
}
|
||||
SASSERT(check(n));
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ void mpfx_manager::set_core(mpfx & n, mpq_manager<SYNCH> & m, mpq const & v) {
|
|||
if (sz > m_total_sz)
|
||||
throw overflow_exception();
|
||||
unsigned * w = words(n);
|
||||
::copy(sz, m_tmp_digits.c_ptr(), m_total_sz, w);
|
||||
::copy(sz, m_tmp_digits.data(), m_total_sz, w);
|
||||
}
|
||||
SASSERT(check(n));
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ void mpfx_manager::mul(mpfx const & a, mpfx const & b, mpfx & c) {
|
|||
else {
|
||||
allocate_if_needed(c);
|
||||
c.m_sign = a.m_sign ^ b.m_sign;
|
||||
unsigned * r = m_buffer0.c_ptr();
|
||||
unsigned * r = m_buffer0.data();
|
||||
m_mpn_manager.mul(words(a), m_total_sz, words(b), m_total_sz, r);
|
||||
// round result
|
||||
unsigned * _r = r + m_frac_part_sz;
|
||||
|
@ -460,7 +460,7 @@ void mpfx_manager::div(mpfx const & a, mpfx const & b, mpfx & c) {
|
|||
allocate_if_needed(c);
|
||||
c.m_sign = a.m_sign ^ b.m_sign;
|
||||
unsigned * w_a = words(a);
|
||||
unsigned * w_a_shft = m_buffer0.c_ptr();
|
||||
unsigned * w_a_shft = m_buffer0.data();
|
||||
unsigned a_shft_sz = sz(w_a) + m_frac_part_sz;
|
||||
// copy a to buffer 0, and shift by m_frac_part_sz
|
||||
for (unsigned i = 0; i < m_frac_part_sz; i++)
|
||||
|
@ -469,7 +469,7 @@ void mpfx_manager::div(mpfx const & a, mpfx const & b, mpfx & c) {
|
|||
w_a_shft[i+m_frac_part_sz] = w_a[i];
|
||||
unsigned * w_b = words(b);
|
||||
unsigned b_sz = sz(w_b);
|
||||
unsigned * w_q = m_buffer1.c_ptr();
|
||||
unsigned * w_q = m_buffer1.data();
|
||||
if (b_sz > a_shft_sz) {
|
||||
if ((c.m_sign == 1) != m_to_plus_inf)
|
||||
set_epsilon(c);
|
||||
|
@ -478,7 +478,7 @@ void mpfx_manager::div(mpfx const & a, mpfx const & b, mpfx & c) {
|
|||
}
|
||||
else {
|
||||
unsigned q_sz = a_shft_sz - b_sz + 1;
|
||||
unsigned * w_r = m_buffer2.c_ptr();
|
||||
unsigned * w_r = m_buffer2.data();
|
||||
unsigned r_sz = b_sz;
|
||||
m_mpn_manager.div(w_a_shft, a_shft_sz,
|
||||
w_b, b_sz,
|
||||
|
@ -811,7 +811,7 @@ void mpfx_manager::display_smt2(std::ostream & out, mpfx const & n) const {
|
|||
out << m_mpn_manager.to_string(w, sz, str_buffer.begin(), str_buffer.size());
|
||||
if (!is_int(n)) {
|
||||
out << " ";
|
||||
unsigned * w = m_buffer0.c_ptr();
|
||||
unsigned * w = m_buffer0.data();
|
||||
for (unsigned i = 0; i < m_frac_part_sz; i++)
|
||||
w[i] = 0;
|
||||
w[m_frac_part_sz] = 1;
|
||||
|
@ -831,10 +831,10 @@ void mpfx_manager::display_decimal(std::ostream & out, mpfx const & n, unsigned
|
|||
out << m_mpn_manager.to_string(w + m_frac_part_sz, m_int_part_sz, str_buffer.begin(), str_buffer.size());
|
||||
if (!is_int(n)) {
|
||||
out << ".";
|
||||
unsigned * frac = m_buffer0.c_ptr();
|
||||
unsigned * frac = m_buffer0.data();
|
||||
::copy(m_frac_part_sz, w, m_frac_part_sz, frac);
|
||||
unsigned ten = 10;
|
||||
unsigned * n_frac = m_buffer1.c_ptr();
|
||||
unsigned * n_frac = m_buffer1.data();
|
||||
bool frac_is_zero = false;
|
||||
unsigned i = 0;
|
||||
while (!frac_is_zero) {
|
||||
|
|
|
@ -90,7 +90,7 @@ class mpfx_manager {
|
|||
mpfx m_one;
|
||||
mpn_manager m_mpn_manager;
|
||||
|
||||
unsigned * words(mpfx const & n) const { return m_words.c_ptr() + (n.m_sig_idx * m_total_sz); }
|
||||
unsigned * words(mpfx const & n) const { return m_words.data() + (n.m_sig_idx * m_total_sz); }
|
||||
unsigned sz(unsigned * ws) const;
|
||||
|
||||
void ensure_capacity(unsigned sig_idx) {
|
||||
|
|
|
@ -201,14 +201,14 @@ bool mpn_manager::div(mpn_digit const * numer, size_t const lnum,
|
|||
|
||||
#ifdef Z3DEBUG
|
||||
mpn_sbuffer temp(lnum+1, 0);
|
||||
mul(quot, lnum-lden+1, denom, lden, temp.c_ptr());
|
||||
mul(quot, lnum-lden+1, denom, lden, temp.data());
|
||||
size_t real_size;
|
||||
add(temp.c_ptr(), lnum, rem, lden, temp.c_ptr(), lnum+1, &real_size);
|
||||
add(temp.data(), lnum, rem, lden, temp.data(), lnum+1, &real_size);
|
||||
bool ok = true;
|
||||
for (size_t i = 0; i < lnum && ok; i++)
|
||||
if (temp[i] != numer[i]) ok = false;
|
||||
if (temp[lnum] != 0) ok = false;
|
||||
CTRACE("mpn_dbg", !ok, tout << "DIV BUG: quot * denom + rem = "; display_raw(tout, temp.c_ptr(), lnum+1); tout << std::endl; );
|
||||
CTRACE("mpn_dbg", !ok, tout << "DIV BUG: quot * denom + rem = "; display_raw(tout, temp.data(), lnum+1); tout << std::endl; );
|
||||
SASSERT(ok);
|
||||
#endif
|
||||
|
||||
|
@ -249,8 +249,8 @@ size_t mpn_manager::div_normalize(mpn_digit const * numer, size_t const lnum,
|
|||
d = 0;
|
||||
}
|
||||
|
||||
TRACE("mpn_norm", tout << "Normalized: n_numer="; display_raw(tout, n_numer.c_ptr(), n_numer.size());
|
||||
tout << " n_denom="; display_raw(tout, n_denom.c_ptr(), n_denom.size()); tout << std::endl; );
|
||||
TRACE("mpn_norm", tout << "Normalized: n_numer="; display_raw(tout, n_numer.data(), n_numer.size());
|
||||
tout << " n_denom="; display_raw(tout, n_denom.data(), n_denom.size()); tout << std::endl; );
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ bool mpn_manager::div_1(mpn_sbuffer & numer, mpn_digit const denom,
|
|||
mpn_double_digit r_hat = temp % (mpn_double_digit) denom;
|
||||
tout << "j=" << j << " q_hat=" << q_hat << " r_hat=" << r_hat;
|
||||
tout << " ms=" << ms;
|
||||
tout << " new numer="; display_raw(tout, numer.c_ptr(), numer.size());
|
||||
tout << " new numer="; display_raw(tout, numer.data(), numer.size());
|
||||
tout << " borrow=" << borrow;
|
||||
tout << std::endl; );
|
||||
}
|
||||
|
@ -331,20 +331,20 @@ bool mpn_manager::div_n(mpn_sbuffer & numer, mpn_sbuffer const & denom,
|
|||
// Replace numer[j+n]...numer[j] with
|
||||
// numer[j+n]...numer[j] - q * (denom[n-1]...denom[0])
|
||||
mpn_digit q_hat_small = (mpn_digit)q_hat;
|
||||
mul(&q_hat_small, 1, denom.c_ptr(), n, ms.c_ptr());
|
||||
sub(&numer[j], n+1, ms.c_ptr(), n+1, &numer[j], &borrow);
|
||||
mul(&q_hat_small, 1, denom.data(), n, ms.data());
|
||||
sub(&numer[j], n+1, ms.data(), n+1, &numer[j], &borrow);
|
||||
quot[j] = q_hat_small;
|
||||
if (borrow) {
|
||||
quot[j]--;
|
||||
ab.resize(n+2);
|
||||
size_t real_size;
|
||||
add(denom.c_ptr(), n, &numer[j], n+1, ab.c_ptr(), n+2, &real_size);
|
||||
add(denom.data(), n, &numer[j], n+1, ab.data(), n+2, &real_size);
|
||||
for (size_t i = 0; i < n+1; i++)
|
||||
numer[j+i] = ab[i];
|
||||
}
|
||||
TRACE("mpn_div", tout << "q_hat=" << q_hat << " r_hat=" << r_hat;
|
||||
tout << " ms="; display_raw(tout, ms.c_ptr(), n);
|
||||
tout << " new numer="; display_raw(tout, numer.c_ptr(), m+n+1);
|
||||
tout << " ms="; display_raw(tout, ms.data(), n);
|
||||
tout << " new numer="; display_raw(tout, numer.data(), m+n+1);
|
||||
tout << " borrow=" << borrow;
|
||||
tout << std::endl; );
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class numeral_buffer {
|
|||
svector<Numeral> m_buffer;
|
||||
public:
|
||||
typedef Numeral numeral;
|
||||
typedef Numeral data;
|
||||
typedef Numeral data_t;
|
||||
typedef NumeralManager manager;
|
||||
|
||||
numeral_buffer(NumeralManager & m):m_manager(m) {}
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
m_buffer.reset();
|
||||
}
|
||||
|
||||
Numeral * c_ptr() { return m_buffer.c_ptr(); }
|
||||
Numeral * data() { return m_buffer.data(); }
|
||||
|
||||
void reserve(unsigned sz) {
|
||||
m_buffer.reserve(sz);
|
||||
|
|
|
@ -105,7 +105,7 @@ struct param_descrs::imp {
|
|||
if (!period) return false;
|
||||
svector<char> prefix_((unsigned)(period-str), str);
|
||||
prefix_.push_back(0);
|
||||
prefix = symbol(prefix_.c_ptr());
|
||||
prefix = symbol(prefix_.data());
|
||||
suffix = symbol(period + 1);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
typedef T * data;
|
||||
typedef T * data_t;
|
||||
|
||||
ref_buffer_core(Ref const & r = Ref()):
|
||||
Ref(r) {
|
||||
|
@ -79,16 +79,16 @@ public:
|
|||
return m_buffer.back();
|
||||
}
|
||||
|
||||
T ** c_ptr() const {
|
||||
return m_buffer.c_ptr();
|
||||
T ** data() const {
|
||||
return m_buffer.data();
|
||||
}
|
||||
|
||||
T * operator[](unsigned idx) const {
|
||||
return m_buffer[idx];
|
||||
}
|
||||
|
||||
T* const* begin() const { return c_ptr(); }
|
||||
T* const* end() const { return c_ptr() + size(); }
|
||||
T* const* begin() const { return data(); }
|
||||
T* const* end() const { return data() + size(); }
|
||||
|
||||
void set(unsigned idx, T * n) {
|
||||
inc_ref(n);
|
||||
|
@ -121,7 +121,7 @@ public:
|
|||
}
|
||||
|
||||
void append(ref_buffer_core const & other) {
|
||||
append(other.size(), other.c_ptr());
|
||||
append(other.size(), other.data());
|
||||
}
|
||||
|
||||
void resize(unsigned sz) {
|
||||
|
|
|
@ -45,7 +45,7 @@ protected:
|
|||
}
|
||||
|
||||
public:
|
||||
typedef T * data;
|
||||
typedef T * data_t;
|
||||
|
||||
ref_pair_vector_core(Ref const & r = Ref()):Ref(r) {}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public:
|
|||
|
||||
elem_t const& get(unsigned idx) const { return m_nodes[idx]; }
|
||||
|
||||
elem_t const * c_ptr() const { return m_nodes.begin(); }
|
||||
elem_t const * data() const { return m_nodes.begin(); }
|
||||
|
||||
typedef elem_t const* iterator;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ protected:
|
|||
}
|
||||
};
|
||||
public:
|
||||
typedef T * data;
|
||||
typedef T * data_t;
|
||||
|
||||
ref_vector_core() = default;
|
||||
ref_vector_core(Ref const & r) : Ref(r) {}
|
||||
|
@ -130,11 +130,11 @@ public:
|
|||
|
||||
T * get(unsigned idx, T * d) const { return m_nodes.get(idx, d); }
|
||||
|
||||
T * const * c_ptr() const { return m_nodes.begin(); }
|
||||
T * const * data() const { return m_nodes.begin(); }
|
||||
|
||||
typedef T* const* iterator;
|
||||
|
||||
T ** c_ptr() { return m_nodes.begin(); }
|
||||
T ** data() { return m_nodes.begin(); }
|
||||
|
||||
unsigned hash() const {
|
||||
unsigned sz = size();
|
||||
|
|
|
@ -169,7 +169,7 @@ void sexpr::display_atom(std::ostream & out) const {
|
|||
}
|
||||
std::reverse(buf.begin(), buf.end());
|
||||
buf.push_back(0);
|
||||
out << buf.c_ptr();
|
||||
out << buf.data();
|
||||
break;
|
||||
}
|
||||
case sexpr::kind_t::STRING:
|
||||
|
|
|
@ -241,7 +241,7 @@ Notes:
|
|||
return mk_or(n, xs);
|
||||
}
|
||||
if (dualize(k, n, xs, in)) {
|
||||
return le(full, k, in.size(), in.c_ptr());
|
||||
return le(full, k, in.size(), in.data());
|
||||
}
|
||||
else {
|
||||
switch (m_cfg.m_encoding) {
|
||||
|
@ -272,7 +272,7 @@ Notes:
|
|||
SASSERT(k < n);
|
||||
literal_vector in, out;
|
||||
if (dualize(k, n, xs, in)) {
|
||||
return ge(full, k, n, in.c_ptr());
|
||||
return ge(full, k, n, in.data());
|
||||
}
|
||||
else if (k == 1) {
|
||||
literal_vector ors;
|
||||
|
@ -322,7 +322,7 @@ Notes:
|
|||
SASSERT(k <= n);
|
||||
literal_vector in, out;
|
||||
if (dualize(k, n, xs, in)) {
|
||||
return eq(full, k, n, in.c_ptr());
|
||||
return eq(full, k, n, in.data());
|
||||
}
|
||||
else if (k == 1) {
|
||||
// scoped_stats _ss(m_stats, k, n);
|
||||
|
@ -526,12 +526,12 @@ Notes:
|
|||
ors.push_back(mk_and(x[i], mk_not(c), mk_not(y[i])));
|
||||
ors.push_back(mk_and(y[i], mk_not(c), mk_not(x[i])));
|
||||
ors.push_back(mk_and(c, x[i], y[i]));
|
||||
literal o = mk_or(4, ors.c_ptr());
|
||||
literal o = mk_or(4, ors.data());
|
||||
out.push_back(o);
|
||||
ors[0] = mk_and(c, x[i]);
|
||||
ors[1] = mk_and(c, y[i]);
|
||||
ors[2] = mk_and(x[i], y[i]);
|
||||
c = mk_or(3, ors.c_ptr());
|
||||
c = mk_or(3, ors.data());
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ Notes:
|
|||
switch (j) {
|
||||
case 0: return ctx.mk_false();
|
||||
case 1: return ors[0];
|
||||
default: return ctx.mk_max(ors.size(), ors.c_ptr());
|
||||
default: return ctx.mk_max(ors.size(), ors.data());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ Notes:
|
|||
}
|
||||
|
||||
literal mk_or(literal_vector const& ors) {
|
||||
return mk_or(ors.size(), ors.c_ptr());
|
||||
return mk_or(ors.size(), ors.data());
|
||||
}
|
||||
|
||||
literal mk_not(literal lit) {
|
||||
|
@ -688,7 +688,7 @@ Notes:
|
|||
case 2:
|
||||
return mk_min(ands[0], ands[1]);
|
||||
default: {
|
||||
return ctx.mk_min(ands.size(), ands.c_ptr());
|
||||
return ctx.mk_min(ands.size(), ands.data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ Notes:
|
|||
r1 = mk_and(r1, mk_or(ors));
|
||||
}
|
||||
else {
|
||||
add_implies_or(r1, ors.size(), ors.c_ptr());
|
||||
add_implies_or(r1, ors.size(), ors.data());
|
||||
}
|
||||
return r1;
|
||||
}
|
||||
|
@ -738,9 +738,9 @@ Notes:
|
|||
if (n + 1 == inc_size) ++inc_size;
|
||||
for (unsigned i = 0; i < n; i += inc_size) {
|
||||
unsigned inc = std::min(n - i, inc_size);
|
||||
mk_at_most_1_small(full, inc, in.c_ptr() + i, result, ands);
|
||||
mk_at_most_1_small(full, inc, in.data() + i, result, ands);
|
||||
if (use_ors || n > inc_size) {
|
||||
ors.push_back(mk_or(inc, in.c_ptr() + i));
|
||||
ors.push_back(mk_or(inc, in.data() + i));
|
||||
}
|
||||
}
|
||||
if (n <= inc_size) {
|
||||
|
@ -902,8 +902,8 @@ Notes:
|
|||
literal_vector ands;
|
||||
for (unsigned i = 0; i < n; i += inc_size) {
|
||||
unsigned inc = std::min(n - i, inc_size);
|
||||
mk_at_most_1_small(full, inc, in.c_ptr() + i, result, ands);
|
||||
ors.push_back(mk_or(inc, in.c_ptr() + i));
|
||||
mk_at_most_1_small(full, inc, in.data() + i, result, ands);
|
||||
ors.push_back(mk_or(inc, in.data() + i));
|
||||
}
|
||||
|
||||
unsigned nbits = 0;
|
||||
|
@ -989,7 +989,7 @@ Notes:
|
|||
add_clause(2, lits);
|
||||
}
|
||||
void add_clause(literal_vector const& lits) {
|
||||
add_clause(lits.size(), lits.c_ptr());
|
||||
add_clause(lits.size(), lits.data());
|
||||
}
|
||||
void add_clause(unsigned n, literal const* ls) {
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
|
@ -998,7 +998,7 @@ Notes:
|
|||
m_stats.m_num_compiled_clauses++;
|
||||
m_stats.m_num_clause_vars += n;
|
||||
literal_vector tmp(n, ls);
|
||||
ctx.mk_clause(n, tmp.c_ptr());
|
||||
ctx.mk_clause(n, tmp.data());
|
||||
}
|
||||
|
||||
// y1 <= mk_max(x1,x2)
|
||||
|
@ -1048,7 +1048,7 @@ Notes:
|
|||
unsigned half = n/2; // TBD
|
||||
card(k, half, xs, out1);
|
||||
card(k, n-half, xs + half, out2);
|
||||
smerge(k, out1.size(), out1.c_ptr(), out2.size(), out2.c_ptr(), out);
|
||||
smerge(k, out1.size(), out1.data(), out2.size(), out2.data(), out);
|
||||
}
|
||||
TRACE("pb_verbose", tout << "card k: " << k << " n: " << n << "\n";
|
||||
//pp(tout << "in:", n, xs) << "\n";
|
||||
|
@ -1109,10 +1109,10 @@ Notes:
|
|||
split(b, bs, even_b, odd_b);
|
||||
SASSERT(!even_a.empty());
|
||||
SASSERT(!even_b.empty());
|
||||
merge(even_a.size(), even_a.c_ptr(),
|
||||
even_b.size(), even_b.c_ptr(), out1);
|
||||
merge(odd_a.size(), odd_a.c_ptr(),
|
||||
odd_b.size(), odd_b.c_ptr(), out2);
|
||||
merge(even_a.size(), even_a.data(),
|
||||
even_b.size(), even_b.data(), out1);
|
||||
merge(odd_a.size(), odd_a.data(),
|
||||
odd_b.size(), odd_b.data(), out2);
|
||||
interleave(out1, out2, out);
|
||||
}
|
||||
TRACE("pb_verbose", tout << "merge a: " << a << " b: " << b << " ";
|
||||
|
@ -1213,8 +1213,8 @@ Notes:
|
|||
unsigned half = n/2; // TBD
|
||||
sorting(half, xs, out1);
|
||||
sorting(n-half, xs+half, out2);
|
||||
merge(out1.size(), out1.c_ptr(),
|
||||
out2.size(), out2.c_ptr(),
|
||||
merge(out1.size(), out1.data(),
|
||||
out2.size(), out2.data(),
|
||||
out);
|
||||
}
|
||||
break;
|
||||
|
@ -1305,10 +1305,10 @@ Notes:
|
|||
else {
|
||||
c1 = (c + 1)/2; c2 = (c - 1)/2;
|
||||
}
|
||||
smerge(c1, even_a.size(), even_a.c_ptr(),
|
||||
even_b.size(), even_b.c_ptr(), out1);
|
||||
smerge(c2, odd_a.size(), odd_a.c_ptr(),
|
||||
odd_b.size(), odd_b.c_ptr(), out2);
|
||||
smerge(c1, even_a.size(), even_a.data(),
|
||||
even_b.size(), even_b.data(), out1);
|
||||
smerge(c2, odd_a.size(), odd_a.data(),
|
||||
odd_b.size(), odd_b.data(), out2);
|
||||
SASSERT(out1.size() == std::min(even_a.size()+even_b.size(), c1));
|
||||
SASSERT(out2.size() == std::min(odd_a.size()+odd_b.size(), c2));
|
||||
literal y;
|
||||
|
|
|
@ -46,7 +46,7 @@ void statistics::reset() {
|
|||
template<typename V, typename M>
|
||||
static void mk_map(V const & v, M & m) {
|
||||
for (auto const& p : v) {
|
||||
typename V::data::second_type val;
|
||||
typename V::data_t::second_type val;
|
||||
if (m.find(p.first, val))
|
||||
m.insert(p.first, p.second + val);
|
||||
else
|
||||
|
|
|
@ -120,7 +120,7 @@ class vector {
|
|||
}
|
||||
|
||||
public:
|
||||
typedef T data;
|
||||
typedef T data_t;
|
||||
typedef T * iterator;
|
||||
typedef const T * const_iterator;
|
||||
|
||||
|
@ -528,7 +528,7 @@ public:
|
|||
append(sz, data);
|
||||
}
|
||||
|
||||
T * c_ptr() const {
|
||||
T * data() const {
|
||||
return m_data;
|
||||
}
|
||||
|
||||
|
@ -654,10 +654,10 @@ struct vector_hash_tpl {
|
|||
};
|
||||
|
||||
template<typename Hash>
|
||||
struct vector_hash : public vector_hash_tpl<Hash, vector<typename Hash::data> > {};
|
||||
struct vector_hash : public vector_hash_tpl<Hash, vector<typename Hash::data_t> > {};
|
||||
|
||||
template<typename Hash>
|
||||
struct svector_hash : public vector_hash_tpl<Hash, svector<typename Hash::data> > {};
|
||||
struct svector_hash : public vector_hash_tpl<Hash, svector<typename Hash::data_t> > {};
|
||||
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -99,10 +99,10 @@ void format2ostream(std::ostream & out, char const* msg, va_list args) {
|
|||
// +1 is for NUL termination.
|
||||
buff.resize(static_cast<unsigned>(msg_len + 1));
|
||||
|
||||
VPRF(buff.c_ptr(), buff.size(), msg, args);
|
||||
VPRF(buff.data(), buff.size(), msg, args);
|
||||
|
||||
END_ERR_HANDLER();
|
||||
out << buff.c_ptr();
|
||||
out << buff.data();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue