[PPL-devel] [GIT] ppl/ppl(master): Prefer explicit test against zero.

Enea Zaffanella zaffanella at cs.unipr.it
Sat Feb 25 10:50:41 CET 2012


Module: ppl/ppl
Branch: master
Commit: 2ee9075c66455229ef794874e2f1bdf45e02c6d4
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=2ee9075c66455229ef794874e2f1bdf45e02c6d4

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Sat Feb 25 10:49:52 2012 +0100

Prefer explicit test against zero.
Detected by ECLAIR service utypflag.

---

 src/checked_mpz.inlines.hh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/checked_mpz.inlines.hh b/src/checked_mpz.inlines.hh
index afa84b0..e8aec87 100644
--- a/src/checked_mpz.inlines.hh
+++ b/src/checked_mpz.inlines.hh
@@ -510,7 +510,7 @@ template <typename To_Policy, typename From_Policy>
 inline Result
 smod_2exp_mpz(mpz_class& to, const mpz_class& x, unsigned int exp,
 	      Rounding_Dir) {
-  if (mpz_tstbit(x.get_mpz_t(), exp - 1))
+  if (mpz_tstbit(x.get_mpz_t(), exp - 1) != 0)
     mpz_cdiv_r_2exp(to.get_mpz_t(), x.get_mpz_t(), exp);
   else
     mpz_fdiv_r_2exp(to.get_mpz_t(), x.get_mpz_t(), exp);




More information about the PPL-devel mailing list