mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-19 18:35:07 +03:00
ipa: raspberry: replace abs() with std::abs()
pwl.cpp uses abs() instead of std::abs(), which causes unexpected behavior in the Clang compiler used for Android. Replace with C++-standard absolute value function std::abs(), which supports double-precision absolute values in a standard way. Signed-off-by: Nicholas Roth <nicholas@rothemail.net> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
6a2f971035
commit
e1e6c1b2f6
1 changed files with 3 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "pwl.h"
|
||||
|
@ -168,7 +169,7 @@ Pwl Pwl::compose(Pwl const &other, const double eps) const
|
|||
while (thisSpan != (int)points_.size() - 1) {
|
||||
double dx = points_[thisSpan + 1].x - points_[thisSpan].x,
|
||||
dy = points_[thisSpan + 1].y - points_[thisSpan].y;
|
||||
if (abs(dy) > eps &&
|
||||
if (std::abs(dy) > eps &&
|
||||
otherSpan + 1 < (int)other.points_.size() &&
|
||||
points_[thisSpan + 1].y >=
|
||||
other.points_[otherSpan + 1].x + eps) {
|
||||
|
@ -181,7 +182,7 @@ Pwl Pwl::compose(Pwl const &other, const double eps) const
|
|||
points_[thisSpan].y) *
|
||||
dx / dy;
|
||||
thisY = other.points_[++otherSpan].x;
|
||||
} else if (abs(dy) > eps && otherSpan > 0 &&
|
||||
} else if (std::abs(dy) > eps && otherSpan > 0 &&
|
||||
points_[thisSpan + 1].y <=
|
||||
other.points_[otherSpan - 1].x - eps) {
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue