From 21fddf7d1c0653881773e44cea6e9d0804a08b31 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 16 May 2016 00:48:02 +0200 Subject: C99/C++11: replace deprecated finite() by isfinite(). --- source/blender/blenlib/BLI_math_base.h | 10 ---------- source/blender/blenlib/intern/math_base.c | 2 +- source/blender/blenlib/intern/math_vector.c | 2 +- source/blender/blenlib/intern/math_vector_inline.c | 6 +++--- 4 files changed, 5 insertions(+), 15 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 20b76354f58..e97a250cd24 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -37,10 +37,6 @@ #include #include "BLI_math_inline.h" -#ifdef __sun__ -#include /* for finite() */ -#endif - #ifndef M_PI #define M_PI 3.14159265358979323846 /* pi */ #endif @@ -146,12 +142,6 @@ static const int NAN_INT = 0x7FC00000; #endif /* C99, POSIX.1-2001 or MSVC12 (partial C99) */ -#ifdef WIN32 -# if defined(_MSC_VER) -# define finite(n) _finite(n) -# endif -#endif - #if BLI_MATH_DO_INLINE #include "intern/math_base_inline.c" #endif diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index 0a1e9e8a8a1..14eba3e61a4 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -56,7 +56,7 @@ double double_round(double x, int ndigits) pow2 = 1.0; y = (x * pow1) * pow2; /* if y overflows, then rounded value is exactly x */ - if (!finite(y)) + if (!isfinite(y)) return x; } else { diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 3e464327b2e..46e25fc3f4f 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -669,7 +669,7 @@ void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3]) if (f > eps) { const float d = 1.0f / sqrtf(f); - BLI_assert(finite(d)); + BLI_assert(isfinite(d)); r_n1[0] = n[1] * d; r_n1[1] = -n[0] * d; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 17e2da3f1cb..76f2af34723 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -954,17 +954,17 @@ MINLINE bool is_zero_v4(const float v[4]) MINLINE bool is_finite_v2(const float v[2]) { - return (finite(v[0]) && finite(v[1])); + return (isfinite(v[0]) && isfinite(v[1])); } MINLINE bool is_finite_v3(const float v[3]) { - return (finite(v[0]) && finite(v[1]) && finite(v[2])); + return (isfinite(v[0]) && isfinite(v[1]) && isfinite(v[2])); } MINLINE bool is_finite_v4(const float v[4]) { - return (finite(v[0]) && finite(v[1]) && finite(v[2]) && finite(v[3])); + return (isfinite(v[0]) && isfinite(v[1]) && isfinite(v[2]) && isfinite(v[3])); } MINLINE bool is_one_v3(const float v[3]) -- cgit v1.2.3