3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-09-30 05:09:02 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-04-30 09:30:43 -07:00
commit f525f43e43
155 changed files with 3188 additions and 1043 deletions

View file

@ -45,7 +45,7 @@ namespace datalog {
protected:
sort_ref m_sort;
bool m_limited_size;
uint64 m_size;
uint64_t m_size;
sort_domain(sort_kind k, context & ctx, sort * s)
: m_kind(k), m_sort(s, ctx.get_manager()) {
@ -103,15 +103,15 @@ namespace datalog {
};
class context::uint64_sort_domain : public sort_domain {
typedef map<uint64, finite_element, uint64_hash, default_eq<uint64> > el2num;
typedef svector<uint64> num2el;
typedef map<uint64_t, finite_element, uint64_hash, default_eq<uint64_t> > el2num;
typedef svector<uint64_t> num2el;
el2num m_el_numbers;
num2el m_el_names;
public:
uint64_sort_domain(context & ctx, sort * s) : sort_domain(SK_UINT64, ctx, s) {}
finite_element get_number(uint64 el) {
finite_element get_number(uint64_t el) {
//we number symbols starting from zero, so table->size() is equal to the
//index of the symbol to be added next
@ -368,14 +368,14 @@ namespace datalog {
return dom.get_number(sym);
}
context::finite_element context::get_constant_number(relation_sort srt, uint64 el) {
context::finite_element context::get_constant_number(relation_sort srt, uint64_t el) {
sort_domain & dom0 = get_sort_domain(srt);
SASSERT(dom0.get_kind()==SK_UINT64);
uint64_sort_domain & dom = static_cast<uint64_sort_domain &>(dom0);
return dom.get_number(el);
}
void context::print_constant_name(relation_sort srt, uint64 num, std::ostream & out)
void context::print_constant_name(relation_sort srt, uint64_t num, std::ostream & out)
{
if (has_sort_domain(srt)) {
SASSERT(num<=UINT_MAX);
@ -386,7 +386,7 @@ namespace datalog {
}
}
bool context::try_get_sort_constant_count(relation_sort srt, uint64 & constant_count) {
bool context::try_get_sort_constant_count(relation_sort srt, uint64_t & constant_count) {
if (!has_sort_domain(srt)) {
return false;
}
@ -394,18 +394,18 @@ namespace datalog {
return true;
}
uint64 context::get_sort_size_estimate(relation_sort srt) {
uint64_t context::get_sort_size_estimate(relation_sort srt) {
if (get_decl_util().is_rule_sort(srt)) {
return 1;
}
uint64 res;
uint64_t res;
if (!try_get_sort_constant_count(srt, res)) {
const sort_size & sz = srt->get_num_elements();
if (sz.is_finite()) {
res = sz.size();
}
else {
res = std::numeric_limits<uint64>::max();
res = std::numeric_limits<uint64_t>::max();
}
}
return res;

View file

@ -61,7 +61,7 @@ namespace datalog {
class relation_manager;
typedef sort * relation_sort;
typedef uint64 table_element;
typedef uint64_t table_element;
typedef svector<table_element> table_fact;
typedef app * relation_element;
@ -351,16 +351,16 @@ namespace datalog {
/**
\brief Return number of a symbol in a DK_UINT64 kind sort (\see register_sort() )
*/
finite_element get_constant_number(relation_sort srt, uint64 el);
finite_element get_constant_number(relation_sort srt, uint64_t el);
/**
\brief Output name of constant with number \c num in sort \c sort.
*/
void print_constant_name(relation_sort sort, uint64 num, std::ostream & out);
void print_constant_name(relation_sort sort, uint64_t num, std::ostream & out);
bool try_get_sort_constant_count(relation_sort srt, uint64 & constant_count);
bool try_get_sort_constant_count(relation_sort srt, uint64_t & constant_count);
uint64 get_sort_size_estimate(relation_sort srt);
uint64_t get_sort_size_estimate(relation_sort srt);
/**
\brief Assign names of variables used in the declaration of a predicate.

View file

@ -141,7 +141,7 @@ namespace datalog {
}
void cost_recorder::start(accounted_object * obj) {
uint64 curr_time = static_cast<uint64>(m_stopwatch->get_current_seconds()*1000);
uint64_t curr_time = static_cast<uint64_t>(m_stopwatch->get_current_seconds()*1000);
if(m_obj) {
costs::time_type time_delta = static_cast<costs::time_type>(curr_time-m_last_time);
costs & c = m_obj->get_current_costs();

View file

@ -95,7 +95,7 @@ namespace datalog {
stopwatch * m_stopwatch;
bool m_running;
uint64 m_last_time;
uint64_t m_last_time;
public:
cost_recorder();
~cost_recorder();

View file

@ -31,6 +31,10 @@ Revision History:
#include "muz/base/dl_rule.h"
#include "muz/base/dl_util.h"
#include "util/stopwatch.h"
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
namespace datalog {
@ -165,7 +169,7 @@ namespace datalog {
}
expr * arg = f->get_arg(i);
uint64 sym_num;
uint64_t sym_num;
SASSERT(is_app(arg));
VERIFY( ctx.get_decl_util().is_numeral_ext(to_app(arg), sym_num) );
relation_sort sort = pred_decl->get_domain(i);
@ -626,11 +630,11 @@ namespace datalog {
return name.substr(ofs, count);
}
bool string_to_uint64(const char * s, uint64 & res) {
bool string_to_uint64(const char * s, uint64_t & res) {
#if _WINDOWS
int converted = sscanf_s(s, "%I64u", &res);
int converted = sscanf_s(s, "%" SCNu64, &res);
#else
int converted = sscanf(s, "%llu", &res);
int converted = sscanf(s, "%" SCNu64, &res);
#endif
if(converted==0) {
return false;
@ -639,9 +643,9 @@ namespace datalog {
return true;
}
bool read_uint64(const char * & s, uint64 & res) {
static const uint64 max_but_one_digit = ULLONG_MAX/10;
static const uint64 max_but_one_digit_safe = (ULLONG_MAX-9)/10;
bool read_uint64(const char * & s, uint64_t & res) {
static const uint64_t max_but_one_digit = ULLONG_MAX/10;
static const uint64_t max_but_one_digit_safe = (ULLONG_MAX-9)/10;
if(*s<'0' || *s>'9') {
return false;
@ -669,7 +673,7 @@ namespace datalog {
return true;
}
std::string to_string(uint64 num) {
std::string to_string(uint64_t num) {
std::stringstream stm;
stm<<num;
return stm.str();

View file

@ -602,8 +602,8 @@ namespace datalog {
\brief If it is possible to convert the beginning of \c s to uint64,
store the result of conversion and return true; otherwise return false.
*/
bool string_to_uint64(const char * s, uint64 & res);
std::string to_string(uint64 num);
bool string_to_uint64(const char * s, uint64_t & res);
std::string to_string(uint64_t num);
/**
\brief Read the sequence of decimal digits starting at \c s and interpret it as
uint64. If successful, \c res will contain the read number and \c s will point
@ -612,7 +612,7 @@ namespace datalog {
overflows, \c points to the character which caused the overflow and false is
returned.
*/
bool read_uint64(const char * & s, uint64 & res);
bool read_uint64(const char * & s, uint64_t & res);
};
#endif /* DL_UTIL_H_ */