[PPL-devel] [GIT] ppl/ppl(master): Prefer using vector::resize wrt insert.

Enea Zaffanella zaffanella at cs.unipr.it
Wed Feb 15 23:10:27 CET 2012


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Wed Feb 15 22:48:38 2012 +0100

Prefer using vector::resize wrt insert.

---

 src/conversion.cc |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/conversion.cc b/src/conversion.cc
index 0f7e0b8..bb37274 100644
--- a/src/conversion.cc
+++ b/src/conversion.cc
@@ -398,9 +398,8 @@ PPL::Polyhedron::conversion(Linear_System& source,
     // product is 0 if and only if the generator saturates the
     // constraint.
     PPL_DIRTY_TEMP(std::vector<Coefficient>, scalar_prod);
-    const int needed_space = dest_num_rows - scalar_prod.size();
-    if (needed_space > 0)
-      scalar_prod.insert(scalar_prod.end(), needed_space, Coefficient_zero());
+    if (dest_num_rows > scalar_prod.size())
+      scalar_prod.resize(dest_num_rows, Coefficient_zero());
     // `index_non_zero' will indicate the first generator in `dest'
     // that does not saturate the constraint `source_k'.
     dimension_type index_non_zero = 0;




More information about the PPL-devel mailing list