
Module: ppl/ppl Branch: master Commit: 05d2137112f498fdcc29803d4e4608700790e8cc URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=05d2137112f49...
Author: Roberto Bagnara bagnara@cs.unipr.it Date: Sun Oct 9 20:58:54 2011 +0200
Magic constants avoided. Detected by ECLAIR service nomagicc.
---
src/Init.cc | 2 +- src/Init.defs.hh | 8 ++++++++ src/OR_Matrix.inlines.hh | 13 +++++++------ 3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/Init.cc b/src/Init.cc index f7f847c..3cee7c4 100644 --- a/src/Init.cc +++ b/src/Init.cc @@ -176,7 +176,7 @@ PPL::Init::Init() {
// The default is choosen to have a precision greater than most // precise IEC559 floating point (112 bits of mantissa). - set_irrational_precision(128); + set_irrational_precision(DEFAULT_IRRATIONAL_PRECISION); } }
diff --git a/src/Init.defs.hh b/src/Init.defs.hh index 7a9ee4b..57d1cec 100644 --- a/src/Init.defs.hh +++ b/src/Init.defs.hh @@ -73,6 +73,14 @@ public: ~Init();
private: + /*! \brief + Default precision parameter used for irrational calculations. + + The default is choosen to have a precision greater than most + precise IEC559 floating point (112 bits of mantissa). + */ + static const unsigned DEFAULT_IRRATIONAL_PRECISION = 128U; + //! Count the number of objects created. static unsigned int count; static fpu_rounding_direction_type old_rounding_direction; diff --git a/src/OR_Matrix.inlines.hh b/src/OR_Matrix.inlines.hh index 401bb0c..fa7f284 100644 --- a/src/OR_Matrix.inlines.hh +++ b/src/OR_Matrix.inlines.hh @@ -30,8 +30,8 @@ site: http://www.cs.unipr.it/ppl/ . */ #include "C_Polyhedron.defs.hh" #include "distances.defs.hh" #include "assert.hh" -#include <algorithm> #include "checked.defs.hh" +#include <algorithm>
namespace Parma_Polyhedra_Library {
@@ -405,11 +405,12 @@ OR_Matrix<T>::swap(OR_Matrix& y) { }
//! Returns the integer square root of \p x. -inline unsigned long -isqrt(unsigned long x) { - unsigned long r = 0; - for (unsigned long t = 0x40000000; t; t >>= 2) { - unsigned long s = r + t; +inline dimension_type +isqrt(dimension_type x) { + dimension_type r = 0; + const dimension_type FIRST_BIT_MASK = 0x40000000U; + for (dimension_type t = FIRST_BIT_MASK; t; t >>= 2) { + dimension_type s = r + t; if (s <= x) { x -= s; r = s + t;