diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp index 3d218817..69a93341 100644 --- a/src/ipa/libipa/pwl.cpp +++ b/src/ipa/libipa/pwl.cpp @@ -210,6 +210,10 @@ double Pwl::eval(double x, int *span, bool updateSpan) const : points_.size() / 2 - 1); if (span && updateSpan) *span = index; + + if (points_.size() == 1) + return points_[0].y(); + return points_[index].y() + (x - points_[index].x()) * (points_[index + 1].y() - points_[index].y()) / (points_[index + 1].x() - points_[index].x()); diff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build index c553366a..2070bed7 100644 --- a/test/ipa/libipa/meson.build +++ b/test/ipa/libipa/meson.build @@ -4,7 +4,7 @@ libipa_test = [ {'name': 'fixedpoint', 'sources': ['fixedpoint.cpp']}, {'name': 'histogram', 'sources': ['histogram.cpp']}, {'name': 'interpolator', 'sources': ['interpolator.cpp']}, - {'name': 'pwl', 'sources': ['pwl.cpp'], 'should_fail': true }, + {'name': 'pwl', 'sources': ['pwl.cpp'] }, ] foreach test : libipa_test