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:
parent
25a29bf5b0
commit
c577ab361b
9 changed files with 81 additions and 21 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue