[PPL-devel] [GIT] ppl/ppl(master): Removed a few redundant casts.

Enea Zaffanella zaffanella at cs.unipr.it
Thu Nov 3 19:07:57 CET 2011


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Thu Nov  3 17:55:05 2011 +0100

Removed a few redundant casts.
Detected by ECLAIR service castexpr.

---

 src/Grid_Generator_System.cc |    5 +++--
 src/Grid_nonpublic.cc        |    4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Grid_Generator_System.cc b/src/Grid_Generator_System.cc
index 9945b63..0f1aed9 100644
--- a/src/Grid_Generator_System.cc
+++ b/src/Grid_Generator_System.cc
@@ -319,9 +319,10 @@ PPL::Grid_Generator_System
   // Swap the parameter divisor column into the new last column.
   swap_columns(col, col + dims);
   // Set the diagonal element of each added rows.
-  dimension_type num_rows = this->num_rows();
+  Grid_Generator_System& x = *this;
+  const dimension_type num_rows = x.num_rows();
   for (dimension_type row = num_rows - dims; row < num_rows; ++row, ++col)
-    const_cast<Coefficient&>((*this)[row][col]) = 1;
+    x[row][col] = 1;
 }
 
 void
diff --git a/src/Grid_nonpublic.cc b/src/Grid_nonpublic.cc
index b00088d..39c09ee 100644
--- a/src/Grid_nonpublic.cc
+++ b/src/Grid_nonpublic.cc
@@ -62,7 +62,7 @@ PPL::Grid::construct(dimension_type num_dimensions,
     // dimension and then store it in `con_sys'.
     Congruence_System cgs(Congruence::zero_dim_false());
     cgs.increase_space_dimension(space_dim);
-    const_cast<Congruence_System&>(con_sys).swap(cgs);
+    con_sys.swap(cgs);
 
     PPL_ASSERT(OK());
     return;
@@ -456,7 +456,7 @@ PPL::Grid::set_empty() {
   // dimension and then swap it with `con_sys'.
   Congruence_System cgs(Congruence::zero_dim_false());
   cgs.increase_space_dimension(space_dim);
-  const_cast<Congruence_System&>(con_sys).swap(cgs);
+  con_sys.swap(cgs);
 }
 
 void




More information about the PPL-devel mailing list