
Module: ppl/ppl Branch: master Commit: 7682a06a0a07e2070438880368ef2d465fa71e38 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=7682a06a0a07e...
Author: Roberto Bagnara bagnara@cs.unipr.it Date: Fri Nov 4 20:10:21 2011 +0100
Avoid reusing names reserved by the C++ standard. In the process, consistency improved with respect to conventions used throughout the library. Detected by ECLAIR service resvidnt.
---
src/Bit_Row.defs.hh | 31 ++++++++++--------------------- src/Bit_Row.inlines.hh | 23 ++++++++++------------- src/Polyhedron_nonpublic.cc | 35 ++++++++++++++++++----------------- 3 files changed, 38 insertions(+), 51 deletions(-)
diff --git a/src/Bit_Row.defs.hh b/src/Bit_Row.defs.hh index c876893..30984bc 100644 --- a/src/Bit_Row.defs.hh +++ b/src/Bit_Row.defs.hh @@ -85,24 +85,6 @@ bool subset_or_equal(const Bit_Row& x, const Bit_Row& y, #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) bool strict_subset(const Bit_Row& x, const Bit_Row& y);
-#ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS -//! Set-theoretic union. -/*! \relates Bit_Row */ -#endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) -void set_union(const Bit_Row& x, const Bit_Row& y, Bit_Row& z); - -#ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS -//! Set-theoretic intersection. -/*! \relates Bit_Row */ -#endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) -void set_intersection(const Bit_Row& x, const Bit_Row& y, Bit_Row& z); - -#ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS -//! Set-theoretic difference. -/*! \relates Bit_Row */ -#endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS) -void set_difference(const Bit_Row& x, const Bit_Row& y, Bit_Row& z); - } // namespace Parma_Polyhedra_Library
#ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS @@ -150,6 +132,16 @@ public: //! Clears all the bits of the row. void clear();
+ //! Assigns to \p *this the set-theoretic union of \p x and \p y. + void union_assign(const Bit_Row& x, const Bit_Row& y); + + //! Assigns to \p *this the set-theoretic intersection of \p x and \p y. + void intersection_assign(const Bit_Row& x, const Bit_Row& y); + + //! Assigns to \p *this the set-theoretic difference of \p x and \p y. + void difference_assign(const Bit_Row& x, const Bit_Row& y); + + friend int compare(const Bit_Row& x, const Bit_Row& y); friend bool operator==(const Bit_Row& x, const Bit_Row& y); friend bool operator!=(const Bit_Row& x, const Bit_Row& y); @@ -157,9 +149,6 @@ public: friend bool subset_or_equal(const Bit_Row& x, const Bit_Row& y, bool& strict_subset); friend bool strict_subset(const Bit_Row& x, const Bit_Row& y); - friend void set_union(const Bit_Row& x, const Bit_Row& y, Bit_Row& z); - friend void set_intersection(const Bit_Row& x, const Bit_Row& y, Bit_Row& z); - friend void set_difference(const Bit_Row& x, const Bit_Row& y, Bit_Row& z);
//! Returns the index of the first set bit or ULONG_MAX if no bit is set. unsigned long first() const; diff --git a/src/Bit_Row.inlines.hh b/src/Bit_Row.inlines.hh index 3e815c3..c9882e3 100644 --- a/src/Bit_Row.inlines.hh +++ b/src/Bit_Row.inlines.hh @@ -126,39 +126,36 @@ Bit_Row::total_memory_in_bytes() const { return sizeof(*this) + external_memory_in_bytes(); }
-/*! \relates Bit_Row */ inline void -set_union(const Bit_Row& x, const Bit_Row& y, Bit_Row& z) { +Bit_Row::union_assign(const Bit_Row& x, const Bit_Row& y) { const mp_size_t x_size = x.vec->_mp_size; PPL_ASSERT(x_size >= 0); const mp_size_t y_size = y.vec->_mp_size; 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); - mpz_realloc2(z.vec, y_size * PPL_BITS_PER_GMP_LIMB); - z.union_helper(x, y); + <= ULONG_MAX / PPL_BITS_PER_GMP_LIMB); + mpz_realloc2(vec, 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); - mpz_realloc2(z.vec, x_size * PPL_BITS_PER_GMP_LIMB); - z.union_helper(y, x); + mpz_realloc2(vec, x_size * PPL_BITS_PER_GMP_LIMB); + union_helper(y, x); } }
-/*! \relates Bit_Row */ inline void -set_intersection(const Bit_Row& x, const Bit_Row& y, Bit_Row& z) { - mpz_and(z.vec, x.vec, y.vec); +Bit_Row::intersection_assign(const Bit_Row& x, const Bit_Row& y) { + mpz_and(vec, x.vec, y.vec); }
-/*! \relates Bit_Row */ inline void -set_difference(const Bit_Row& x, const Bit_Row& y, Bit_Row& z) { +Bit_Row::difference_assign(const Bit_Row& x, const Bit_Row& y) { PPL_DIRTY_TEMP(mpz_class, complement_y); mpz_com(complement_y.get_mpz_t(), y.vec); - mpz_and(z.vec, x.vec, complement_y.get_mpz_t()); + mpz_and(vec, x.vec, complement_y.get_mpz_t()); }
namespace Implementation { diff --git a/src/Polyhedron_nonpublic.cc b/src/Polyhedron_nonpublic.cc index eaa2007..75e7564 100644 --- a/src/Polyhedron_nonpublic.cc +++ b/src/Polyhedron_nonpublic.cc @@ -1145,7 +1145,7 @@ PPL::Polyhedron::strongly_minimize_constraints() const { if (cs[i].is_strict_inequality()) { // First, check if it is saturated by no closure points Bit_Row sat_ci; - set_union(sat[i], sat_lines_and_closure_points, sat_ci); + sat_ci.union_assign(sat[i], sat_lines_and_closure_points); if (sat_ci == sat_lines) { // It is saturated by no closure points. if (!found_eps_leq_one) { @@ -1181,8 +1181,9 @@ PPL::Polyhedron::strongly_minimize_constraints() const { // Now we check if there exists another strict inequality // constraint having a superset of its saturators, // when disregarding points. + /* FIXME: what is this clear for? */ sat_ci.clear(); - set_union(sat[i], sat_all_but_points, sat_ci); + sat_ci.union_assign(sat[i], sat_all_but_points); bool eps_redundant = false; for (dimension_type j = 0; j < cs_rows; ++j) if (i != j && cs[j].is_strict_inequality() @@ -1531,7 +1532,7 @@ PPL::Polyhedron::BHZ09_C_poly_hull_assign_if_exact(const Polyhedron& y) { const bool included = y.relation_with(x_cs[i]).implies(Poly_Con_Relation::is_included()); if (!included) { - set_union(x_gs_red_in_y, x_sat[i], row_union); + row_union.union_assign(x_gs_red_in_y, x_sat[i]); if (row_union != all_ones) return false; } @@ -1610,8 +1611,8 @@ PPL::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(const Polyhedron& y) { return true;
Bit_Row x_nonpoints_nonred_in_y; - set_difference(x_gs_nonred_in_y, x_points_nonred_in_y, - x_nonpoints_nonred_in_y); + x_nonpoints_nonred_in_y.difference_assign(x_gs_nonred_in_y, + x_points_nonred_in_y);
const Constraint_System& x_cs = x.con_sys; const Constraint_System& y_cs = y.con_sys; @@ -1655,20 +1656,20 @@ PPL::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(const Polyhedron& y) { // Skip constraint if it is not violated by `y'. if (y.relation_with(x_c).implies(Poly_Con_Relation::is_included())) continue; - set_difference(all_ones, x_sat[i], saturators); + saturators.difference_assign(all_ones, x_sat[i]); // Check condition 1. - set_intersection(x_nonpoints_nonred_in_y, saturators, tmp_set); + tmp_set.intersection_assign(x_nonpoints_nonred_in_y, saturators); if (!tmp_set.empty()) return false; if (x_c.is_strict_inequality()) { // Postpone check for condition 3. x_cs_condition_3.set(i); - set_intersection(x_closure_points, saturators, tmp_set); - set_union(x_gs_condition_3, tmp_set, x_gs_condition_3); + tmp_set.intersection_assign(x_closure_points, saturators); + x_gs_condition_3.union_assign(x_gs_condition_3, tmp_set); } else { // Check condition 2. - set_intersection(x_points_nonred_in_y_closure, saturators, tmp_set); + tmp_set.intersection_assign(x_points_nonred_in_y_closure, saturators); if (!tmp_set.empty()) return false; } @@ -1678,8 +1679,8 @@ PPL::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(const Polyhedron& y) { // (the statement of the NNC theorem in BHZ09 is symmetric).
Bit_Row y_nonpoints_nonred_in_x; - set_difference(y_gs_nonred_in_x, y_points_nonred_in_x, - y_nonpoints_nonred_in_x); + y_nonpoints_nonred_in_x.difference_assign(y_gs_nonred_in_x, + y_points_nonred_in_x);
// Filter away the points of `y_gs' that would be redundant // in the topological closure of `x'. @@ -1714,20 +1715,20 @@ PPL::Polyhedron::BHZ09_NNC_poly_hull_assign_if_exact(const Polyhedron& y) { // Skip constraint if it is not violated by `x'. if (x.relation_with(y_c).implies(Poly_Con_Relation::is_included())) continue; - set_difference(all_ones, y_sat[i], saturators); + saturators.difference_assign(all_ones, y_sat[i]); // Check condition 1. - set_intersection(y_nonpoints_nonred_in_x, saturators, tmp_set); + tmp_set.intersection_assign(y_nonpoints_nonred_in_x, saturators); if (!tmp_set.empty()) return false; if (y_c.is_strict_inequality()) { // Postpone check for condition 3. y_cs_condition_3.set(i); - set_intersection(y_closure_points, saturators, tmp_set); - set_union(y_gs_condition_3, tmp_set, y_gs_condition_3); + tmp_set.intersection_assign(y_closure_points, saturators); + y_gs_condition_3.union_assign(y_gs_condition_3, tmp_set); } else { // Check condition 2. - set_intersection(y_points_nonred_in_x_closure, saturators, tmp_set); + tmp_set.intersection_assign(y_points_nonred_in_x_closure, saturators); if (!tmp_set.empty()) return false; }