diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2020-08-20 03:29:09 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2020-08-20 03:29:09 +0300 |
commit | 57c3718447a4b3db92475ecc86a6d793bd839aef (patch) | |
tree | 8dcb56470b97391b0dbb937cf2712bcff76eaebe /source/blender | |
parent | eac84bf52724b082cd2d0aa2ba7669e8053c342a (diff) |
Revert "Use std::abs instead of fabs in C++ code."
This reverts commit eac84bf52724b082cd2d0aa2ba7669e8053c342a.
Using std::abs causes ambiguity problems when compiling on a Mac.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_double2.hh | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_double3.hh | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/delaunay_2d.cc | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/mesh_intersect.cc | 4 | ||||
-rw-r--r-- | source/blender/blenlib/tests/BLI_delaunay_2d_test.cc | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_double2.hh b/source/blender/blenlib/BLI_double2.hh index 1b3d1ae06f3..a85f74ee442 100644 --- a/source/blender/blenlib/BLI_double2.hh +++ b/source/blender/blenlib/BLI_double2.hh @@ -101,7 +101,7 @@ struct double2 { static double2 abs(const double2 &a) { - return double2(std::abs(a.x), std::abs(a.y)); + return double2(fabsf(a.x), fabsf(a.y)); } static double distance(const double2 &a, const double2 &b) diff --git a/source/blender/blenlib/BLI_double3.hh b/source/blender/blenlib/BLI_double3.hh index e9c62e71882..11a88e121ca 100644 --- a/source/blender/blenlib/BLI_double3.hh +++ b/source/blender/blenlib/BLI_double3.hh @@ -218,7 +218,7 @@ struct double3 { static double3 abs(const double3 &a) { - return double3(std::abs(a.x), std::abs(a.y), std::abs(a.z)); + return double3(fabs(a.x), fabs(a.y), fabs(a.z)); } /* orient3d gives the exact result, using multiprecision artihmetic when result diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc index f7523279c9e..0cb53a71432 100644 --- a/source/blender/blenlib/intern/delaunay_2d.cc +++ b/source/blender/blenlib/intern/delaunay_2d.cc @@ -48,7 +48,7 @@ template<> mpq_class math_abs<mpq_class>(const mpq_class v) template<> double math_abs<double>(const double v) { - return std::abs(v); + return fabs(v); } template<typename T> double math_to_double(const T UNUSED(v)) diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index 22d6d830e0a..d0def5c06a2 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -838,7 +838,7 @@ static Array<BoundingBox> calc_face_bounding_boxes(const Mesh &m) for (Vertp v : face) { bb.combine(v->co); for (int i = 0; i < 3; ++i) { - max_abs_val = max_dd(max_abs_val, std::abs(v->co[i])); + max_abs_val = max_dd(max_abs_val, fabs(v->co[i])); } } } @@ -1422,7 +1422,7 @@ static int filter_orient3d(const double3 &a, const double3 &b, const double3 &c, return 0; } double err_bound = supremum_orient3d(a, b, c, d) * index_orient3d * DBL_EPSILON; - if (std::abs(o3dfast) > err_bound) { + if (fabs(o3dfast) > err_bound) { return o3dfast > 0.0 ? 1 : -1; } return 0; diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc index f2e05d573c9..2287389f7aa 100644 --- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc @@ -138,7 +138,7 @@ template<> mpq_class math_abs(const mpq_class v) template<> double math_abs(const double v) { - return std::abs(v); + return fabs(v); } /* Find an output index corresponding to a given coordinate (appproximately). @@ -150,7 +150,7 @@ template<typename T> int get_vertex_by_coord(const CDT_result<T> &out, double x, for (int i = 0; i < nv; ++i) { double vx = math_to_double(out.vert[i][0]); double vy = math_to_double(out.vert[i][1]); - if (std::abs(vx - x) <= 1e-5 && std::abs(vy - y) <= 1e-5) { + if (fabs(vx - x) <= 1e-5 && fabs(vy - y) <= 1e-5) { return i; } } |