3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-06 15:25:46 +00:00

Remove int64, uint64 typedefs in favor of int64_t / uint64_t.

This commit is contained in:
Bruce Mitchener 2018-03-31 14:45:04 +07:00
parent 16a2ad9afd
commit 2fa304d8de
80 changed files with 437 additions and 449 deletions

View file

@ -7,7 +7,7 @@ Module Name:
Abstract:
A class for wrapping checked (and unchecked) int64 operations.
A class for wrapping checked (and unchecked) int64_t operations.
Note: the mpfx class defines a more general class of fixed-point operations.
A tradeoff is that it relies on a manager.
This class several of the most common operations from rational, so
@ -29,15 +29,15 @@ Revision History:
template<bool CHECK>
class checked_int64 {
int64 m_value;
int64_t m_value;
typedef checked_int64 ci;
rational r64(int64 i) { return rational(i, rational::i64()); }
rational r64(int64_t i) { return rational(i, rational::i64()); }
public:
checked_int64(): m_value(0) {}
checked_int64(int64 v): m_value(v) {}
checked_int64(int64_t v): m_value(v) {}
checked_int64(checked_int64 const& other) { m_value = other.m_value; }
class overflow_exception : public z3_exception {
@ -57,7 +57,7 @@ public:
static checked_int64 one() { return ci(1); }
static checked_int64 minus_one() { return ci(-1);}
int64 get_int64() const { return m_value; }
int64_t get_int64() const { return m_value; }
checked_int64 abs() const {
if (m_value >= 0) {
@ -117,9 +117,9 @@ public:
checked_int64& operator+=(checked_int64 const& other) {
if (CHECK) {
uint64 x = static_cast<uint64>(m_value);
uint64 y = static_cast<uint64>(other.m_value);
int64 r = static_cast<int64>(x + y);
uint64_t x = static_cast<uint64_t>(m_value);
uint64_t y = static_cast<uint64_t>(other.m_value);
int64_t r = static_cast<int64_t>(x + y);
if (m_value > 0 && other.m_value > 0 && r <= 0) throw overflow_exception();
if (m_value < 0 && other.m_value < 0 && r >= 0) throw overflow_exception();
m_value = r;
@ -132,9 +132,9 @@ public:
checked_int64& operator-=(checked_int64 const& other) {
if (CHECK) {
uint64 x = static_cast<uint64>(m_value);
uint64 y = static_cast<uint64>(other.m_value);
int64 r = static_cast<int64>(x - y);
uint64_t x = static_cast<uint64_t>(m_value);
uint64_t y = static_cast<uint64_t>(other.m_value);
int64_t r = static_cast<int64_t>(x - y);
if (m_value > 0 && other.m_value < 0 && r <= 0) throw overflow_exception();
if (m_value < 0 && other.m_value > 0 && r >= 0) throw overflow_exception();
m_value = r;