Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80585 - trunk/boost/polygon/detail
From: sydorchuk.andriy_at_[hidden]
Date: 2012-09-18 16:39:20


Author: asydorchuk
Date: 2012-09-18 16:39:19 EDT (Tue, 18 Sep 2012)
New Revision: 80585
URL: http://svn.boost.org/trac/boost/changeset/80585

Log:
Removing static variables from the Voronoi code.

Text files modified:
   trunk/boost/polygon/detail/voronoi_ctypes.hpp | 28 ++++++++++------------------
   trunk/boost/polygon/detail/voronoi_robust_fpt.hpp | 13 +++----------
   2 files changed, 13 insertions(+), 28 deletions(-)

Modified: trunk/boost/polygon/detail/voronoi_ctypes.hpp
==============================================================================
--- trunk/boost/polygon/detail/voronoi_ctypes.hpp (original)
+++ trunk/boost/polygon/detail/voronoi_ctypes.hpp 2012-09-18 16:39:19 EDT (Tue, 18 Sep 2012)
@@ -226,9 +226,6 @@
 template<std::size_t N>
 class extended_int {
  public:
- static const uint64 kUInt64LowMask;
- static const uint64 kUInt64HighMask;
-
   extended_int() {}
 
   extended_int(int32 that) {
@@ -245,12 +242,12 @@
 
   extended_int(int64 that) {
     if (that > 0) {
- this->chunks_[0] = static_cast<uint32>(that & kUInt64LowMask);
+ this->chunks_[0] = static_cast<uint32>(that);
       this->chunks_[1] = that >> 32;
       this->count_ = this->chunks_[1] ? 2 : 1;
     } else if (that < 0) {
       that = -that;
- this->chunks_[0] = static_cast<uint32>(that & kUInt64LowMask);
+ this->chunks_[0] = static_cast<uint32>(that);
       this->chunks_[1] = that >> 32;
       this->count_ = this->chunks_[1] ? -2 : -1;
     } else {
@@ -287,12 +284,12 @@
 
   extended_int& operator=(int64 that) {
     if (that > 0) {
- this->chunks_[0] = static_cast<uint32>(that & kUInt64LowMask);
+ this->chunks_[0] = static_cast<uint32>(that);
       this->chunks_[1] = that >> 32;
       this->count_ = this->chunks_[1] ? 2 : 1;
     } else if (that < 0) {
       that = -that;
- this->chunks_[0] = static_cast<uint32>(that & kUInt64LowMask);
+ this->chunks_[0] = static_cast<uint32>(that);
       this->chunks_[1] = that >> 32;
       this->count_ = this->chunks_[1] ? -2 : -1;
     } else {
@@ -497,16 +494,16 @@
     uint64 temp = 0;
     for (std::size_t i = 0; i < sz2; ++i) {
       temp += static_cast<uint64>(c1[i]) + static_cast<uint64>(c2[i]);
- this->chunks_[i] = static_cast<uint32>(temp & kUInt64LowMask);
+ this->chunks_[i] = static_cast<uint32>(temp);
       temp >>= 32;
     }
     for (std::size_t i = sz2; i < sz1; ++i) {
       temp += static_cast<uint64>(c1[i]);
- this->chunks_[i] = static_cast<uint32>(temp & kUInt64LowMask);
+ this->chunks_[i] = static_cast<uint32>(temp);
       temp >>= 32;
     }
     if (temp && (this->count_ != N)) {
- this->chunks_[this->count_] = static_cast<uint32>(temp & kUInt64LowMask);
+ this->chunks_[this->count_] = static_cast<uint32>(temp);
       ++this->count_;
     }
   }
@@ -565,14 +562,14 @@
         if (second >= sz2)
           continue;
         tmp = static_cast<uint64>(c1[first]) * static_cast<uint64>(c2[second]);
- cur += tmp & kUInt64LowMask;
+ cur += static_cast<uint32>(tmp);
         nxt += tmp >> 32;
       }
- this->chunks_[shift] = static_cast<uint32>(cur & kUInt64LowMask);
+ this->chunks_[shift] = static_cast<uint32>(cur);
       cur = nxt + (cur >> 32);
     }
     if (cur && (this->count_ != N)) {
- this->chunks_[this->count_] = static_cast<uint32>(cur & kUInt64LowMask);
+ this->chunks_[this->count_] = static_cast<uint32>(cur);
       ++this->count_;
     }
   }
@@ -582,11 +579,6 @@
 };
 
 template <std::size_t N>
-const uint64 extended_int<N>::kUInt64LowMask = 0x00000000ffffffffULL;
-template <std::size_t N>
-const uint64 extended_int<N>::kUInt64HighMask = 0xffffffff00000000ULL;
-
-template <std::size_t N>
 bool is_pos(const extended_int<N>& that) {
   return that.count() > 0;
 }

Modified: trunk/boost/polygon/detail/voronoi_robust_fpt.hpp
==============================================================================
--- trunk/boost/polygon/detail/voronoi_robust_fpt.hpp (original)
+++ trunk/boost/polygon/detail/voronoi_robust_fpt.hpp 2012-09-18 16:39:19 EDT (Tue, 18 Sep 2012)
@@ -82,7 +82,9 @@
   typedef _fpt relative_error_type;
 
   // Rounding error is at most 1 EPS.
- static const relative_error_type ROUNDING_ERROR;
+ enum {
+ ROUNDING_ERROR = 1
+ };
 
   robust_fpt() : fpv_(0.0), re_(0.0) {}
   explicit robust_fpt(floating_point_type fpv) :
@@ -216,10 +218,6 @@
 };
 
 template <typename T>
-const typename robust_fpt<T>::relative_error_type
- robust_fpt<T>::ROUNDING_ERROR = 1;
-
-template <typename T>
 robust_fpt<T> get_sqrt(const robust_fpt<T>& that) {
   return that.sqrt();
 }
@@ -435,11 +433,6 @@
 template <typename _int, typename _fpt, typename _converter>
 class robust_sqrt_expr {
  public:
- static const unsigned int EVAL1_MAX_RELATIVE_ERROR;
- static const unsigned int EVAL2_MAX_RELATIVE_ERROR;
- static const unsigned int EVAL3_MAX_RELATIVE_ERROR;
- static const unsigned int EVAL4_MAX_RELATIVE_ERROR;
-
   enum MAX_RELATIVE_ERROR {
     MAX_RELATIVE_ERROR_EVAL1 = 4,
     MAX_RELATIVE_ERROR_EVAL2 = 7,


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk