[PPL-devel] [GIT] ppl/ppl(master): Added some missing parenthesis.

Abramo Bagnara abramo.bagnara at gmail.com
Wed Mar 21 19:39:54 CET 2012


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

Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date:   Wed Mar 21 19:39:49 2012 +0100

Added some missing parenthesis.

---

 demos/ppl_pips/ppl_pips.cc                 |    2 +-
 src/CO_Tree.cc                             |    2 +-
 src/Floating_Point_Expression.templates.hh |   17 +++++++----------
 src/OR_Matrix.inlines.hh                   |    3 ++-
 src/Octagonal_Shape.templates.hh           |   10 +++++-----
 src/checked.cc                             |    2 +-
 src/checked_int.inlines.hh                 |    2 +-
 7 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/demos/ppl_pips/ppl_pips.cc b/demos/ppl_pips/ppl_pips.cc
index a3d27d7..b60d2ce 100644
--- a/demos/ppl_pips/ppl_pips.cc
+++ b/demos/ppl_pips/ppl_pips.cc
@@ -307,7 +307,7 @@ public:
 
     PPL::dimension_type bignum_column = (bignum_column_coding == -1)
       ? PPL::not_a_dimension()
-      : (bignum_column_coding + num_vars - 1);
+      : (num_vars + (bignum_column_coding - 1));
 
     bool result = update_pip(num_vars, num_params,
                              num_constraints, num_ctx_rows,
diff --git a/src/CO_Tree.cc b/src/CO_Tree.cc
index d94624a..f7f8d3a 100644
--- a/src/CO_Tree.cc
+++ b/src/CO_Tree.cc
@@ -165,7 +165,7 @@ PPL::CO_Tree::erase_element_and_shift_left(dimension_type key) {
     return;
   dimension_type i = dfs_index(itr);
   dimension_type* p = indexes + i;
-  dimension_type* p_end = indexes + reserved_size + 1;
+  dimension_type* p_end = indexes + (reserved_size + 1);
   for ( ; p != p_end; ++p)
     if (*p != unused_index)
       --(*p);
diff --git a/src/Floating_Point_Expression.templates.hh b/src/Floating_Point_Expression.templates.hh
index a6c3d80..38f05ab 100644
--- a/src/Floating_Point_Expression.templates.hh
+++ b/src/Floating_Point_Expression.templates.hh
@@ -93,16 +93,13 @@ template<typename FP_Interval_Type, typename FP_Format>
 FP_Interval_Type
 Floating_Point_Expression<FP_Interval_Type, FP_Format>
 ::compute_absolute_error() {
-  boundary_type omega = std::max(
-  static_cast<typename Floating_Point_Expression<FP_Interval_Type, FP_Format>
-  ::boundary_type>(pow(FP_Format::BASE, static_cast<typename
-		       Floating_Point_Expression<FP_Interval_Type, FP_Format>
-		       ::boundary_type>(1) - FP_Format
-		       ::EXPONENT_BIAS - FP_Format
-		       ::MANTISSA_BITS)),
-  std::numeric_limits<typename
-                      Floating_Point_Expression<FP_Interval_Type, FP_Format>
-  ::boundary_type>::denorm_min());
+  typedef typename Floating_Point_Expression<FP_Interval_Type, FP_Format>
+    ::boundary_type Boundary;
+  boundary_type omega;
+  omega = std::max(pow(static_cast<Boundary>(FP_Format::BASE),
+                       static_cast<Boundary>(1 - FP_Format::EXPONENT_BIAS
+                                             - FP_Format::MANTISSA_BITS)),
+                   std::numeric_limits<Boundary>::denorm_min());
   FP_Interval_Type result;
   result.build(i_constraint(GREATER_OR_EQUAL, -omega),
                i_constraint(LESS_OR_EQUAL, omega));
diff --git a/src/OR_Matrix.inlines.hh b/src/OR_Matrix.inlines.hh
index 91917e8..ea8113b 100644
--- a/src/OR_Matrix.inlines.hh
+++ b/src/OR_Matrix.inlines.hh
@@ -267,7 +267,8 @@ template <typename Unsigned>
 inline typename
 Enable_If<(static_cast<Unsigned>(-1) > 0),
             typename OR_Matrix<T>::template any_row_iterator<U>& >::type
-OR_Matrix<T>::any_row_iterator<U>::operator+=(Unsigned m) {
+OR_Matrix<T>::any_row_iterator<U>::operator+=(Unsigned m_) {
+  dimension_type m = m_;
   dimension_type increment = m + ((m * m) / 2) + (m * e);
   if (e % 2 == 0 && m % 2 != 0)
     ++increment;
diff --git a/src/Octagonal_Shape.templates.hh b/src/Octagonal_Shape.templates.hh
index 1544ab9..aaa87f0 100644
--- a/src/Octagonal_Shape.templates.hh
+++ b/src/Octagonal_Shape.templates.hh
@@ -235,7 +235,7 @@ Octagonal_Shape<T>::Octagonal_Shape(const Generator_System& gs)
           const Coefficient& g_i = g.coefficient(Variable(i));
           const dimension_type di = 2*i;
           Row_Reference x_i = *(mat_begin + di);
-          Row_Reference x_ii = *(mat_begin + di + 1);
+          Row_Reference x_ii = *(mat_begin + (di + 1));
           for (dimension_type j = 0; j < i; ++j) {
             const Coefficient& g_j = g.coefficient(Variable(j));
             const dimension_type dj = 2*j;
@@ -262,7 +262,7 @@ Octagonal_Shape<T>::Octagonal_Shape(const Generator_System& gs)
           const Coefficient& g_i = g.coefficient(Variable(i));
           const dimension_type di = 2*i;
           Row_Reference x_i = *(mat_begin + di);
-          Row_Reference x_ii = *(mat_begin + di + 1);
+          Row_Reference x_ii = *(mat_begin + (di + 1));
           for (dimension_type j = 0; j < i; ++j) {
             const Coefficient& g_j = g.coefficient(Variable(j));
             const dimension_type dj = 2*j;
@@ -308,7 +308,7 @@ Octagonal_Shape<T>::Octagonal_Shape(const Generator_System& gs)
           const Coefficient& g_i = g.coefficient(Variable(i));
           const dimension_type di = 2*i;
           Row_Reference x_i = *(mat_begin + di);
-          Row_Reference x_ii = *(mat_begin + di + 1);
+          Row_Reference x_ii = *(mat_begin + (di + 1));
           for (dimension_type j = 0; j < i; ++j) {
             const Coefficient& g_j = g.coefficient(Variable(j));
             const dimension_type dj = 2*j;
@@ -336,7 +336,7 @@ Octagonal_Shape<T>::Octagonal_Shape(const Generator_System& gs)
           const Coefficient& g_i = g.coefficient(Variable(i));
           const dimension_type di = 2*i;
           Row_Reference x_i = *(mat_begin + di);
-          Row_Reference x_ii = *(mat_begin + di + 1);
+          Row_Reference x_ii = *(mat_begin + (di + 1));
           for (dimension_type j = 0; j < i; ++j) {
             const Coefficient& g_j = g.coefficient(Variable(j));
             const dimension_type dj = 2*j;
@@ -1403,7 +1403,7 @@ Octagonal_Shape<T>::frequency(const Linear_Expression& expr,
           break;
         }
 
-        m_j = *(m_begin + j + 1);
+        m_j = *(m_begin + (j + 1));
         m_cj = *(m_begin + cjj);
         const N& m_j_i1 = m_j[i];
         const N& m_i_j1 = m_cj[ci];
diff --git a/src/checked.cc b/src/checked.cc
index 12a725e..2ec4abf 100644
--- a/src/checked.cc
+++ b/src/checked.cc
@@ -301,7 +301,7 @@ parse_number_part(std::istream& is, number_struct& numer) {
         if (numer.exponent > max_exp_div
             || (numer.exponent == max_exp_div && d > max_exp_rem))
           return V_CVT_STR_UNK;
-        numer.exponent = 10 * numer.exponent + static_cast<unsigned int>(d);
+        numer.exponent = 10 * numer.exponent + static_cast<unsigned long>(d);
         break;
       }
       if (empty_exponent)
diff --git a/src/checked_int.inlines.hh b/src/checked_int.inlines.hh
index 9e6a34d..5fd4e0c 100644
--- a/src/checked_int.inlines.hh
+++ b/src/checked_int.inlines.hh
@@ -1364,7 +1364,7 @@ mul_2exp_signed_int(Type& to, const Type x, unsigned int exp,
       return V_EQ;
     }
   }
-  Type mask = ((Type(1) << exp) - 1) << (sizeof_to_bits(sizeof(Type)) - 1 - exp);
+  Type mask = ((Type(1) << exp) - 1) << ((sizeof_to_bits(sizeof(Type)) - 1) - exp);
   Type n;
   if (x < 0) {
     if ((x & mask) != mask)




More information about the PPL-devel mailing list