[PPL-devel] [GIT] ppl/ppl(master): Prefer using C_Integer traits rather than <climits> macros,

Enea Zaffanella zaffanella at cs.unipr.it
Thu Feb 23 18:41:49 CET 2012


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Thu Feb 23 18:40:30 2012 +0100

Prefer using C_Integer traits rather than <climits> macros,
thereby avoiding implicit conversions changing type signedness.
Detected by ECLAIR service utypflag.

---

 src/Bit_Row.inlines.hh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Bit_Row.inlines.hh b/src/Bit_Row.inlines.hh
index 159cf48..fb10b91 100644
--- a/src/Bit_Row.inlines.hh
+++ b/src/Bit_Row.inlines.hh
@@ -57,13 +57,13 @@ Bit_Row::Bit_Row(const Bit_Row& y, const Bit_Row& z) {
   PPL_ASSERT(z_size >= 0);
   if (y_size < z_size) {
     PPL_ASSERT(static_cast<unsigned long>(z_size)
-           <= ULONG_MAX / PPL_BITS_PER_GMP_LIMB);
+               <= C_Integer<unsigned long>::max / PPL_BITS_PER_GMP_LIMB);
     mpz_init2(vec, static_cast<unsigned long>(z_size) * PPL_BITS_PER_GMP_LIMB);
     union_helper(y, z);
   }
   else {
     PPL_ASSERT(static_cast<unsigned long>(y_size)
-           <= ULONG_MAX / PPL_BITS_PER_GMP_LIMB);
+               <= C_Integer<unsigned long>::max / PPL_BITS_PER_GMP_LIMB);
     mpz_init2(vec, static_cast<unsigned long>(y_size) * PPL_BITS_PER_GMP_LIMB);
     union_helper(z, y);
   }
@@ -135,13 +135,13 @@ Bit_Row::union_assign(const Bit_Row& x, const Bit_Row& y) {
   PPL_ASSERT(y_size >= 0);
   if (x_size < y_size) {
     PPL_ASSERT(static_cast<unsigned long>(y_size)
-               <= ULONG_MAX / PPL_BITS_PER_GMP_LIMB);
+               <= C_Integer<unsigned long>::max / PPL_BITS_PER_GMP_LIMB);
     mpz_realloc2(vec, static_cast<unsigned long>(y_size) * PPL_BITS_PER_GMP_LIMB);
     union_helper(x, y);
   }
   else {
     PPL_ASSERT(static_cast<unsigned long>(x_size)
-           <= ULONG_MAX / PPL_BITS_PER_GMP_LIMB);
+               <= C_Integer<unsigned long>::max / PPL_BITS_PER_GMP_LIMB);
     mpz_realloc2(vec, static_cast<unsigned long>(x_size) * PPL_BITS_PER_GMP_LIMB);
     union_helper(y, x);
   }




More information about the PPL-devel mailing list