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

fix assorted undefined behaviors caught by clang

Signed-off-by: Nuno Lopes <nlopes@microsoft.com>
This commit is contained in:
Nuno Lopes 2015-05-23 11:45:12 +01:00
parent 25a29bf5b0
commit c577ab361b
9 changed files with 81 additions and 21 deletions

View file

@ -33,6 +33,8 @@ class inf_int_rational {
rational m_first;
int m_second;
public:
static void init(); // called from rational::initialize() only
static void finalize(); // called from rational::finalize() only
unsigned hash() const {
return m_first.hash() ^ (static_cast<unsigned>(m_second) + 1);
@ -272,7 +274,7 @@ class inf_int_rational {
if (r.m_second >= 0) {
return r.m_first;
}
return r.m_first - rational(1);
return r.m_first - rational::one();
}
return floor(r.m_first);
@ -283,7 +285,7 @@ class inf_int_rational {
if (r.m_second <= 0) {
return r.m_first;
}
return r.m_first + rational(1);
return r.m_first + rational::one();
}
return ceil(r.m_first);