mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 17:45:32 +00:00
make unit types generic
This commit is contained in:
parent
8a5addd891
commit
7a1a2b2525
2 changed files with 10 additions and 7 deletions
|
@ -254,11 +254,12 @@ namespace polysat {
|
|||
};
|
||||
|
||||
|
||||
struct uint64_ext {
|
||||
typedef uint64_t numeral;
|
||||
template<typename uint_type>
|
||||
struct generic_uint_ext {
|
||||
typedef uint_type numeral;
|
||||
|
||||
struct manager {
|
||||
typedef uint64_t numeral;
|
||||
typedef uint_type numeral;
|
||||
struct hash {
|
||||
unsigned operator()(numeral const& n) const {
|
||||
return static_cast<unsigned>(n);
|
||||
|
@ -269,7 +270,7 @@ namespace polysat {
|
|||
return a == b;
|
||||
}
|
||||
};
|
||||
numeral from_rational(rational const& n) { return n.get_uint64(); }
|
||||
numeral from_rational(rational const& n) { return static_cast<uint_type>(n.get_uint64()); }
|
||||
void reset() {}
|
||||
void reset(numeral& n) { n = 0; }
|
||||
void del(numeral const& n) {}
|
||||
|
@ -333,6 +334,8 @@ namespace polysat {
|
|||
typedef _scoped_numeral<manager> scoped_numeral;
|
||||
};
|
||||
|
||||
typedef generic_uint_ext<uint64_t> uint64_ext;
|
||||
|
||||
|
||||
template<typename Ext>
|
||||
inline std::ostream& operator<<(std::ostream& out, fixplex<Ext> const& fp) {
|
||||
|
|
|
@ -64,12 +64,12 @@ namespace polysat {
|
|||
fixplex_base* b = m_fix.get(sz, nullptr);
|
||||
if (!b) {
|
||||
switch (sz) {
|
||||
case 32:
|
||||
b = alloc(fixplex<generic_uint_ext<unsigned>>, s.m_lim);
|
||||
break;
|
||||
case 64:
|
||||
b = alloc(fixplex<uint64_ext>, s.m_lim);
|
||||
break;
|
||||
case 8:
|
||||
case 16:
|
||||
case 32:
|
||||
case 128:
|
||||
case 256:
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue