summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5387c96)
raw | patch | inline | side by side (parent: 5387c96)
author | pjrm <pjrm@users.sourceforge.net> | |
Fri, 4 Jul 2008 04:56:42 +0000 (04:56 +0000) | ||
committer | pjrm <pjrm@users.sourceforge.net> | |
Fri, 4 Jul 2008 04:56:42 +0000 (04:56 +0000) |
src/2geom/poly.cpp | patch | blob | history | |
src/2geom/poly.h | patch | blob | history |
diff --git a/src/2geom/poly.cpp b/src/2geom/poly.cpp
index 5f766395779b8661db364916eddcddf0885f5152..1b9b0e568e98dfd17b2720ca9a68e0b550b1ca4d 100644 (file)
--- a/src/2geom/poly.cpp
+++ b/src/2geom/poly.cpp
c.resize(k, 0.);
for(unsigned i = k; i >= l; i--) {
- assert(i >= 0);
double ci = r.back()/b.back();
c[i-l] += ci;
Poly bb = ci*b;
diff --git a/src/2geom/poly.h b/src/2geom/poly.h
index f76bc3eeee8b8a43c60850d6113cb5509e614419..2d7b79bfef9d04d1dd2f226d6ad64b8b1c7db891 100644 (file)
--- a/src/2geom/poly.h
+++ b/src/2geom/poly.h
assert(result.size() == out_size);
return result;
}
-// equivalent to multiply by x^terms, discard negative terms
- Poly shifted(unsigned terms) const {
+
+ /** Equivalent to multiply by x^terms. */
+ Poly shifted(unsigned const terms) const {
Poly result;
- // This was a no-op and breaks the build on x86_64, as it's trying
- // to take maximum of 32-bit and 64-bit integers
- //const unsigned out_size = std::max(unsigned(0), size()+terms);
- const size_type out_size = size() + terms;
+ size_type const out_size = size() + terms;
result.reserve(out_size);
-// By definition an unsigned can not be less than zero
-// TODO someone who understands the intent needs to correct this properly
-// if(terms < 0) {
-// for(unsigned i = 0; i < out_size; i++) {
-// result.push_back((*this)[i-terms]);
-// }
-// } else {
- for(unsigned i = 0; i < terms; i++) {
- result.push_back(0.0);
- }
- for(unsigned i = 0; i < size(); i++) {
- result.push_back((*this)[i]);
- }
-// }
-
+ result.resize(terms, 0.0);
+ result.insert(result.end(), this->begin(), this->end());
+
assert(result.size() == out_size);
return result;
}
+
Poly operator*(const Poly& p) const;
template <typename T>