[PPL-devel] [GIT] ppl/ppl(master): Prefer explicit test against zero.
Enea Zaffanella
zaffanella at cs.unipr.it
Sat Feb 25 11:11:50 CET 2012
Module: ppl/ppl
Branch: master
Commit: e37265ae0a0f108cc0ed86f7e848b9ebc8ff7883
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=e37265ae0a0f108cc0ed86f7e848b9ebc8ff7883
Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date: Sat Feb 25 11:08:39 2012 +0100
Prefer explicit test against zero.
Detected by ECLAIR service utypflag.
---
src/checked_mpz.inlines.hh | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/checked_mpz.inlines.hh b/src/checked_mpz.inlines.hh
index e8aec87..9b2c324 100644
--- a/src/checked_mpz.inlines.hh
+++ b/src/checked_mpz.inlines.hh
@@ -329,14 +329,14 @@ assign_mpz_mpq(mpz_class& to, const mpq_class& from, Rounding_Dir dir) {
if (round_down(dir)) {
mpz_fdiv_q(to.get_mpz_t(), n, d);
if (round_strict_relation(dir))
- return mpz_divisible_p(n, d) ? V_EQ : V_GT;
+ return (mpz_divisible_p(n, d) != 0) ? V_EQ : V_GT;
return V_GE;
}
else {
PPL_ASSERT(round_up(dir));
mpz_cdiv_q(to.get_mpz_t(), n, d);
if (round_strict_relation(dir))
- return mpz_divisible_p(n, d) ? V_EQ : V_LT;
+ return (mpz_divisible_p(n, d) != 0) ? V_EQ : V_LT;
return V_LE;
}
}
@@ -403,14 +403,14 @@ div_mpz(mpz_class& to, const mpz_class& x, const mpz_class& y,
if (round_down(dir)) {
mpz_fdiv_q(to.get_mpz_t(), n, d);
if (round_strict_relation(dir))
- return mpz_divisible_p(n, d) ? V_EQ : V_GT;
+ return (mpz_divisible_p(n, d) != 0) ? V_EQ : V_GT;
return V_GE;
}
else {
PPL_ASSERT(round_up(dir));
mpz_cdiv_q(to.get_mpz_t(), n, d);
if (round_strict_relation(dir))
- return mpz_divisible_p(n, d) ? V_EQ : V_LT;
+ return (mpz_divisible_p(n, d) != 0) ? V_EQ : V_LT;
return V_LE;
}
}
@@ -492,7 +492,7 @@ div_2exp_mpz(mpz_class& to, const mpz_class& x, unsigned int exp,
if (round_down(dir)) {
mpz_fdiv_q_2exp(to.get_mpz_t(), n, exp);
if (round_strict_relation(dir))
- return mpz_divisible_2exp_p(n, exp) ? V_EQ : V_GT;
+ return (mpz_divisible_2exp_p(n, exp) != 0) ? V_EQ : V_GT;
return V_GE;
}
else {
More information about the PPL-devel
mailing list