mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
fix semantics of check-int64 div operation to align with smtlib semantics
This commit is contained in:
parent
30d72f79ac
commit
ab43d2dcf1
2 changed files with 15 additions and 0 deletions
|
@ -300,6 +300,16 @@ template<bool CHECK>
|
|||
inline checked_int64<CHECK> div(checked_int64<CHECK> const& a, checked_int64<CHECK> const& b) {
|
||||
checked_int64<CHECK> result(a);
|
||||
result /= b;
|
||||
if (a < 0) {
|
||||
checked_int64<CHECK> r(a);
|
||||
r %= b;
|
||||
if (r != 0) {
|
||||
if (b < 0)
|
||||
result += 1;
|
||||
else
|
||||
result -= 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue