Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75025 - sandbox/gtl/boost/polygon/detail
From: sydorchuk.andriy_at_[hidden]
Date: 2011-10-17 18:47:10


Author: asydorchuk
Date: 2011-10-17 18:47:10 EDT (Mon, 17 Oct 2011)
New Revision: 75025
URL: http://svn.boost.org/trac/boost/changeset/75025

Log:
Fixed previous build.
Removed static variables from the sqrt_expr_evaluator.
Text files modified:
   sandbox/gtl/boost/polygon/detail/voronoi_calc_kernel.hpp | 4
   sandbox/gtl/boost/polygon/detail/voronoi_fpt_kernel.hpp | 89 ++++++++++++++++-----------------------
   2 files changed, 38 insertions(+), 55 deletions(-)

Modified: sandbox/gtl/boost/polygon/detail/voronoi_calc_kernel.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/detail/voronoi_calc_kernel.hpp (original)
+++ sandbox/gtl/boost/polygon/detail/voronoi_calc_kernel.hpp 2011-10-17 18:47:10 EDT (Mon, 17 Oct 2011)
@@ -1457,9 +1457,9 @@
     }
 };
 
-const voronoi_calc_kernel<int>::fpt_type fpt_type voronoi_calc_kernel<int>::fULPS =
+const voronoi_calc_kernel<int>::fpt_type voronoi_calc_kernel<int>::fULPS =
     voronoi_calc_kernel<int>::ULPS;
-const voronoi_calc_kernel<int>::fpt_type fpt_type voronoi_calc_kernel<int>::fULPSx2 =
+const voronoi_calc_kernel<int>::fpt_type voronoi_calc_kernel<int>::fULPSx2 =
     voronoi_calc_kernel<int>::ULPSx2;
 
 } // detail

Modified: sandbox/gtl/boost/polygon/detail/voronoi_fpt_kernel.hpp
==============================================================================
--- sandbox/gtl/boost/polygon/detail/voronoi_fpt_kernel.hpp (original)
+++ sandbox/gtl/boost/polygon/detail/voronoi_fpt_kernel.hpp 2011-10-17 18:47:10 EDT (Mon, 17 Oct 2011)
@@ -515,55 +515,39 @@
         // Evaluates expression:
         // A[0] * sqrt(B[0]).
         mpf eval1(mpt *A, mpt *B) {
-#ifndef THREAD_SAFETY
- static
-#endif
- mpf lhs, rhs, numer;
- lhs = A[0];
- rhs = B[0];
- numer = lhs * sqrt(rhs);
- return numer;
+ lhs[0] = A[0];
+ rhs[0] = B[0];
+ numer[0] = lhs[0] * sqrt(rhs[0]);
+ return numer[0];
         }
 
         // Evaluates expression:
         // A[0] * sqrt(B[0]) + A[1] * sqrt(B[1]) with
         // 7 * EPS relative error in the worst case.
         mpf eval2(mpt *A, mpt *B) {
-#ifndef THREAD_SAFETY
- static
-#endif
- mpf lhs, rhs, numer;
- lhs = eval1(A, B);
- rhs = eval1(A + 1, B + 1);
- if ((lhs >= 0 && rhs >= 0) || (lhs <= 0 && rhs <= 0))
- return lhs + rhs;
- numer = A[0] * A[0] * B[0] - A[1] * A[1] * B[1];
- return numer / (lhs - rhs);
+ lhs[1] = eval1(A, B);
+ rhs[1] = eval1(A + 1, B + 1);
+ if ((lhs[1] >= 0 && rhs[1] >= 0) || (lhs[1] <= 0 && rhs[1] <= 0))
+ return lhs[1] + rhs[1];
+ numer[1] = A[0] * A[0] * B[0] - A[1] * A[1] * B[1];
+ return numer[1] / (lhs[1] - rhs[1]);
         }
 
         // Evaluates expression:
         // A[0] * sqrt(B[0]) + A[1] * sqrt(B[1]) + A[2] * sqrt(B[2])
         // with 16 * EPS relative error in the worst case.
         mpf eval3(mpt *A, mpt *B) {
-#ifndef THREAD_SAFETY
- static
-#endif
- mpt cA[2], cB[2];
-#ifndef THREAD_SAFETY
- static
-#endif
- mpf lhs, rhs, numer;
- lhs = eval2(A, B);
- rhs = eval1(A + 2, B + 2);
- if ((lhs >= 0 && rhs >= 0) || (lhs <= 0 && rhs <= 0))
- return lhs + rhs;
+ lhs[2] = eval2(A, B);
+ rhs[2] = eval1(A + 2, B + 2);
+ if ((lhs[2] >= 0 && rhs[2] >= 0) || (lhs[2] <= 0 && rhs[2] <= 0))
+ return lhs[2] + rhs[2];
             cA[0] = A[0] * A[0] * B[0] + A[1] * A[1] * B[1];
             cA[0] -= A[2] * A[2] * B[2];
             cB[0] = 1;
             cA[1] = A[0] * A[1] * 2;
             cB[1] = B[0] * B[1];
- numer = eval2(cA, cB);
- return numer / (lhs - rhs);
+ numer[2] = eval2(cA, cB);
+ return numer[2] / (lhs[2] - rhs[2]);
         }
 
         
@@ -571,30 +555,29 @@
         // A[0] * sqrt(B[0]) + A[1] * sqrt(B[1]) + A[2] * sqrt(B[2]) + A[3] * sqrt(B[3])
         // with 25 * EPS relative error in the worst case.
         mpf eval4(mpt *A, mpt *B) {
-#ifndef THREAD_SAFETY
- static
-#endif
- mpt cA[3], cB[3];
-#ifndef THREAD_SAFETY
- static
-#endif
- mpf lhs, rhs, numer;
- lhs = eval2(A, B);
- rhs = eval2(A + 2, B + 2);
- if ((lhs >= 0 && rhs >= 0) || (lhs <= 0 && rhs <= 0))
- return lhs + rhs;
- cA[0] = A[0] * A[0] * B[0] + A[1] * A[1] * B[1];
- cA[0] -= A[2] * A[2] * B[2] + A[3] * A[3] * B[3];
- cB[0] = 1;
- cA[1] = A[0] * A[1] * 2;
- cB[1] = B[0] * B[1];
- cA[2] = A[2] * A[3] * -2;
- cB[2] = B[2] * B[3];
- numer = eval3(cA, cB);
- return numer / (lhs - rhs);
+ lhs[3] = eval2(A, B);
+ rhs[3] = eval2(A + 2, B + 2);
+ if ((lhs[3] >= 0 && rhs[3] >= 0) || (lhs[3] <= 0 && rhs[3] <= 0))
+ return lhs[3] + rhs[3];
+ dA[0] = A[0] * A[0] * B[0] + A[1] * A[1] * B[1];
+ dA[0] -= A[2] * A[2] * B[2] + A[3] * A[3] * B[3];
+ dB[0] = 1;
+ dA[1] = A[0] * A[1] * 2;
+ dB[1] = B[0] * B[1];
+ dA[2] = A[2] * A[3] * -2;
+ dB[2] = B[2] * B[3];
+ numer[3] = eval3(dA, dB);
+ return numer[3] / (lhs[3] - rhs[3]);
         }
 
     private:
+ mpf lhs[4];
+ mpf rhs[4];
+ mpf numer[4];
+ mpt cA[2];
+ mpt cB[2];
+ mpt dA[3];
+ mpt dB[3];
     };
 
 } // detail


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