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

merge with pull request #1557

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-04-07 17:22:49 -07:00
commit 2dc92e2b94
93 changed files with 526 additions and 548 deletions

View file

@ -278,7 +278,7 @@ static void tst_select_small(mpbq_manager & m, scoped_mpbq const & l, scoped_mpb
std::cout << "choice: " << r << " as decimal: "; m.display_decimal(std::cout, r); std::cout << std::endl;
}
static void tst_select_small(mpbq_manager & m, int64 n1, unsigned k1, int64 n2, unsigned k2, bool expected) {
static void tst_select_small(mpbq_manager & m, int64_t n1, unsigned k1, int64_t n2, unsigned k2, bool expected) {
scoped_mpbq l(m);
scoped_mpbq u(m);
m.set(l, n1, k1);

View file

@ -95,12 +95,12 @@ void dl_query_test(ast_manager & m, smt_params & fparams, params_ref& params,
f_b.reset();
f_q.reset();
for(unsigned col=0; col<sig_b.size(); col++) {
uint64 sort_sz;
uint64_t sort_sz;
if(!decl_util.try_get_size(sig_q[col], sort_sz)) {
warning_msg("cannot get sort size");
return;
}
uint64 num = ran()%sort_sz;
uint64_t num = ran()%sort_sz;
app * el_b = decl_util.mk_numeral(num, sig_b[col]);
f_b.push_back(el_b);
app * el_q = decl_util.mk_numeral(num, sig_q[col]);
@ -167,7 +167,7 @@ void dl_query_test_wpa(smt_params & fparams, params_ref& params) {
ENSURE(v_pred);
sort * var_sort = v_pred->get_domain(0);
uint64 var_sz;
uint64_t var_sz;
TRUSTME( ctx.try_get_sort_constant_count(var_sort, var_sz) );
for(unsigned attempt=0; attempt<attempts; attempt++) {

View file

@ -43,8 +43,8 @@ static void tst1() {
static void tst2() {
mpff_manager m;
scoped_mpff a(m), b(m);
m.set(a, static_cast<uint64>(100));
m.set(b, static_cast<int64>(-100));
m.set(a, static_cast<uint64_t>(100));
m.set(b, static_cast<int64_t>(-100));
std::cout << "[test2], a: " << a << ", b: " << b << "\n";
}
@ -75,7 +75,7 @@ static void tst4() {
static void tst5() {
mpff_manager m;
scoped_mpff a(m), b(m);
m.set(a, static_cast<uint64>(1) << 63);
m.set(a, static_cast<uint64_t>(1) << 63);
m.display_raw(std::cout, a); std::cout << "\n";
ENSURE(m.is_zero(b));
ENSURE(m.lt(b, a));
@ -117,7 +117,7 @@ static void tst7() {
#define MK_BIN_OP(OP) \
static void tst_ ## OP ## _core(int64 n1, uint64 d1, int64 n2, uint64 d2, unsigned precision = 2, unsigned exp = 0) { \
static void tst_ ## OP ## _core(int64_t n1, uint64_t d1, int64_t n2, uint64_t d2, unsigned precision = 2, unsigned exp = 0) { \
TRACE("mpff_bug", tout << n1 << "/" << d1 << ", " << n2 << "/" << d2 << "\n";); \
unsynch_mpq_manager qm; \
scoped_mpq qa(qm), qb(qm), qc(qm), qt(qm); \
@ -207,7 +207,7 @@ static void tst_set64(unsigned N, unsigned prec) {
mpff_manager fm(prec);
scoped_mpff a(fm);
fm.set(a, static_cast<int64>(INT64_MAX));
fm.set(a, static_cast<int64_t>(INT64_MAX));
ENSURE(fm.is_int64(a));
ENSURE(fm.is_uint64(a));
fm.inc(a);
@ -221,7 +221,7 @@ static void tst_set64(unsigned N, unsigned prec) {
ENSURE(fm.is_int64(a));
ENSURE(fm.is_uint64(a));
fm.set(a, static_cast<int64>(INT64_MIN));
fm.set(a, static_cast<int64_t>(INT64_MIN));
ENSURE(fm.is_int64(a));
ENSURE(!fm.is_uint64(a));
fm.dec(a);
@ -235,7 +235,7 @@ static void tst_set64(unsigned N, unsigned prec) {
ENSURE(fm.is_int64(a));
ENSURE(!fm.is_uint64(a));
fm.set(a, static_cast<uint64>(UINT64_MAX));
fm.set(a, static_cast<uint64_t>(UINT64_MAX));
ENSURE(fm.is_uint64(a));
ENSURE(!fm.is_int64(a));
fm.inc(a);
@ -250,23 +250,23 @@ static void tst_set64(unsigned N, unsigned prec) {
for (unsigned i = 0; i < N; i++) {
{
uint64 v = (static_cast<uint64>(rand()) << 32) + static_cast<uint64>(rand());
uint64_t v = (static_cast<uint64_t>(rand()) << 32) + static_cast<uint64_t>(rand());
fm.set(a, v);
ENSURE(fm.is_uint64(a));
v = (static_cast<uint64>(rand() % 3) << 32) + static_cast<uint64>(rand());
v = (static_cast<uint64_t>(rand() % 3) << 32) + static_cast<uint64_t>(rand());
fm.set(a, v);
ENSURE(fm.is_uint64(a));
}
{
int64 v = (static_cast<uint64>(rand() % INT_MAX) << 32) + static_cast<uint64>(rand());
int64_t v = (static_cast<uint64_t>(rand() % INT_MAX) << 32) + static_cast<uint64_t>(rand());
if (rand()%2 == 0)
v = -v;
fm.set(a, v);
ENSURE(fm.is_int64(a));
v = (static_cast<uint64>(rand() % 3) << 32) + static_cast<uint64>(rand());
v = (static_cast<uint64_t>(rand() % 3) << 32) + static_cast<uint64_t>(rand());
if (rand()%2 == 0)
v = -v;
fm.set(a, v);
@ -336,7 +336,7 @@ static void tst_power(unsigned prec = 2) {
m.set(a, UINT_MAX);
m.inc(a);
ENSURE(m.is_power_of_two(a, k) && k == 32);
ENSURE(m.get_uint64(a) == static_cast<uint64>(UINT_MAX) + 1);
ENSURE(m.get_uint64(a) == static_cast<uint64_t>(UINT_MAX) + 1);
m.power(a, 2, a);
ENSURE(m.is_power_of_two(a, k) && k == 64);
m.power(a, 4, a);
@ -538,7 +538,7 @@ static void tst_add_corner(unsigned prec) {
}
#endif
static void tst_decimal(int64 n, uint64 d, bool to_plus_inf, unsigned prec, char const * expected, unsigned decimal_places = UINT_MAX) {
static void tst_decimal(int64_t n, uint64_t d, bool to_plus_inf, unsigned prec, char const * expected, unsigned decimal_places = UINT_MAX) {
mpff_manager m(prec);
scoped_mpff a(m);
m.set_rounding(to_plus_inf);
@ -567,7 +567,7 @@ static void tst_decimal() {
tst_decimal(-32, 5, true, 2, "-6.39999999999999999965305530480463858111761510372161865234375");
}
static void tst_prev_power_2(int64 n, uint64 d, unsigned expected) {
static void tst_prev_power_2(int64_t n, uint64_t d, unsigned expected) {
mpff_manager m;
scoped_mpff a(m);
m.set(a, n, d);
@ -598,7 +598,7 @@ static void tst_div(unsigned prec) {
scoped_mpff a(m), b(m), c(m);
m.round_to_plus_inf();
m.set(a, 1);
m.set(b, static_cast<uint64>(UINT64_MAX));
m.set(b, static_cast<uint64_t>(UINT64_MAX));
m.div(a, b, c);
m.display_raw(std::cout, a); std::cout << "\n";
m.display_raw(std::cout, b); std::cout << "\n";

View file

@ -35,7 +35,7 @@ static void tst1() {
m.display_decimal(std::cout, a); std::cout << "\n";
}
static void tst_prev_power_2(int64 n, uint64 d, unsigned expected) {
static void tst_prev_power_2(int64_t n, uint64_t d, unsigned expected) {
mpfx_manager m;
scoped_mpfx a(m);
m.set(a, n, d);

View file

@ -133,7 +133,7 @@ static void set_str_bug() {
ENSURE(a == b);
}
static void tst_prev_power_2(int64 n, uint64 d, unsigned expected) {
static void tst_prev_power_2(int64_t n, uint64_t d, unsigned expected) {
unsynch_mpq_manager m;
scoped_mpq a(m);
m.set(a, n, d);

View file

@ -50,7 +50,7 @@ static void tst1() {
static void tst2() {
synch_mpz_manager m;
mpz v1, v2, v3;
m.set(v1, static_cast<int64>(UINT_MAX));
m.set(v1, static_cast<int64_t>(UINT_MAX));
m.add(v1, m.mk_z(1), v2);
m.mul(v2, v2, v3);
std::cout << "v2:\n" << m.to_string(v2) << "\n";
@ -63,7 +63,7 @@ static void tst2() {
static void tst2b() {
synch_mpz_manager m;
mpz v1, v2, v3;
m.set(v1, static_cast<int64>(UINT_MAX));
m.set(v1, static_cast<int64_t>(UINT_MAX));
m.add(v1, m.mk_z(1), v2);
m.mul(v2, v2, v3);
std::cout << "v2:\n" << m.to_string(v2) << "\n";
@ -127,8 +127,8 @@ static void bug3() {
static void bug4() {
synch_mpz_manager m;
mpz x, y;
m.set(y, static_cast<uint64>(4294967295ull));
m.set(x, static_cast<uint64>(4026531839ull));
m.set(y, static_cast<uint64_t>(4294967295ull));
m.set(x, static_cast<uint64_t>(4026531839ull));
mpz result1;
m.bitwise_or(x, y, result1);
@ -282,7 +282,7 @@ void tst_int_min_bug() {
mpz big;
mpz expected;
mpz r;
m.set(big, static_cast<uint64>(UINT64_MAX));
m.set(big, static_cast<uint64_t>(UINT64_MAX));
m.set(expected, "18446744075857035263");
m.sub(big, intmin, r);
std::cout << "r: " << m.to_string(r) << "\nexpected: " << m.to_string(expected) << "\n";

View file

@ -25,7 +25,7 @@ void tst_prime_generator() {
prime_generator gen;
for (unsigned i = 0; i < 10000; i++) {
uint64 p = gen(i);
uint64_t p = gen(i);
std::cout << p << ", ";
if (i % 11 == 0) std::cout << "\n";
std::cout.flush();
@ -33,8 +33,8 @@ void tst_prime_generator() {
continue;
m.set(sqrt_p, p);
m.root(sqrt_p, 2);
uint64 k = m.get_uint64(sqrt_p);
for (uint64 i = 2; i <= k; i++) {
uint64_t k = m.get_uint64(sqrt_p);
for (uint64_t i = 2; i <= k; i++) {
ENSURE(p % i != 0);
}
}

View file

@ -194,8 +194,8 @@ static void tst2() {
ENSURE(uint64_max.is_uint64());
// get_int64, get_uint64
uint64 u1 = uint64_max.get_uint64();
uint64 u2 = UINT64_MAX;
uint64_t u1 = uint64_max.get_uint64();
uint64_t u2 = UINT64_MAX;
VERIFY(u1 == u2);
std::cout << "int64_max: " << int64_max << ", INT64_MAX: " << INT64_MAX << ", int64_max.get_int64(): " << int64_max.get_int64() << ", int64_max.get_uint64(): " << int64_max.get_uint64() << "\n";
ENSURE(int64_max.get_int64() == INT64_MAX);