diff options
author | vng <viktor.govako@gmail.com> | 2013-03-15 18:02:47 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:52:01 +0300 |
commit | 6565c2213d5ea0a7486929da31d4c39d9e697511 (patch) | |
tree | 45ead95bfa32233a65ee1204c93b7d68f5f72050 /base/math.hpp | |
parent | 2d6f3db6a37fec389c6e7437bba111e7f9ccdee8 (diff) |
Fix according to code review.
Diffstat (limited to 'base/math.hpp')
-rw-r--r-- | base/math.hpp | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/base/math.hpp b/base/math.hpp index 06468c0d63..0fd40a2c25 100644 --- a/base/math.hpp +++ b/base/math.hpp @@ -107,81 +107,6 @@ bool IsIntersect(T const & x0, T const & x1, T const & x2, T const & x3) return !((x1 < x2) || (x3 < x0)); } -/* -template <typename T> -void Merge(T const & x0, T const & x1, T const & x2, T const & x3, T & x4, T & x5) -{ - ASSERT(IsIntersect(x0, x1, x2, x3), ()); - x4 = min(x0, x2); - x5 = max(x3, x1); -} - -template <typename T> -size_t MergeSorted(T const * a, size_t as, T const * b, size_t bs, T * c, size_t cs) -{ - T const * arrs [] = {a, b}; - size_t sizes[] = {as, bs}; - size_t idx[] = {0, 0}; - - int i = 0; - int j = 1; - int k = 0; - - if ((sizes[i] == 0) && (sizes[j] == 0)) - return 0; - - if ((sizes[i] == 0) && (sizes[j] != 0)) - swap(i, j); - - while (true) - { - /// selecting start of new interval - if ((idx[j] != sizes[j]) && (arrs[i][idx[i]] > arrs[j][idx[j]])) - swap(i, j); - - c[k] = arrs[i][idx[i]]; - c[k + 1] = arrs[i][idx[i] + 1]; - - idx[i] += 2; - - while (true) - { - if (idx[j] == sizes[j]) - break; - - bool merged = false; - - while (IsIntersect(c[k], c[k + 1], arrs[j][idx[j]], arrs[j][idx[j] + 1])) - { - merged = true; - Merge(c[k], c[k + 1], arrs[j][idx[j]], arrs[j][idx[j] + 1], c[k], c[k + 1]); - idx[j] += 2; - if (idx[j] == sizes[j]) - break; - } - - if (!merged) - break; - - swap(i, j); - } - - /// here idx[i] and idx[j] should point to intervals that - /// aren't overlapping c[k], c[k + 1] - - k += 2; - - if ((idx[i] == sizes[i]) && (idx[j] == sizes[j])) - break; - - if (idx[i] == sizes[i]) - swap(i, j); - } - - return k; -} -*/ - // Computes x^n. template <typename T> inline T PowUint(T x, uint64_t n) { |