diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2022-02-21 15:38:48 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2022-02-21 15:38:48 +0100 |
| commit | 445dcdf81f03dbebacd42fbb7fd015482da16cb4 (patch) | |
| tree | 158c88e00cdd8919c9e50f6fff69d1701ce3df2a | |
| parent | e620e3a149155878a449dcf13e82b4704d2bcb5a (diff) | |
| parent | a7e44969de86db102f840bac344598476ad2810c (diff) | |
Merge branch 'isnan_fix'
| -rw-r--r-- | src/cross_os.h | 12 | ||||
| -rw-r--r-- | src/vectors.h | 2 | ||||
| -rw-r--r-- | src/vkvg_context_internal.c | 6 |
3 files changed, 7 insertions, 13 deletions
diff --git a/src/cross_os.h b/src/cross_os.h index 32f05f0..e2d4350 100644 --- a/src/cross_os.h +++ b/src/cross_os.h @@ -27,11 +27,9 @@ //disable warning on iostream functions on windows #define _CRT_SECURE_NO_WARNINGS #include "windows.h" - #if defined(_WIN32) - #define isnanf isnan - #else - #ifndef isnanf - #define isnanf _isnanf + #if defined(_WIN64) + #ifndef isnan + #define isnan _isnanf #endif #endif #define vkvg_inline __forceinline @@ -39,7 +37,6 @@ #define reset_warning (warn) #elif __APPLE__ #include <math.h> - #define isnanf isnan #define vkvg_inline static #define disable_warning (warn) #define reset_warning (warn) @@ -47,9 +44,6 @@ #include <unistd.h> #include <sys/types.h> #include <pwd.h> - #ifndef isnanf - #define isnanf __isnanf - #endif #define vkvg_inline static inline __attribute((always_inline)) #define disable_warning (warn) #pragma GCC diagnostic ignored "-W"#warn #define reset_warning (warn) #pragma GCC diagnostic warning "-W"#warn diff --git a/src/vectors.h b/src/vectors.h index 25550e4..a8a815f 100644 --- a/src/vectors.h +++ b/src/vectors.h @@ -177,7 +177,7 @@ vkvg_inline void vec2_inv (vec2* v){ } // test if one component of float vector is nan vkvg_inline bool vec2_isnan (vec2 v){ - return (bool)(isnanf (v.x) || isnanf (v.y)); + return (bool)(isnan (v.x) || isnan (v.y)); } // test if one component of double vector is nan vkvg_inline float vec2_dot (vec2 a, vec2 b) { diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index 0d84132..d887281 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -223,7 +223,7 @@ bool _path_is_closed (VkvgContext ctx, uint32_t ptrPath){ void _add_point (VkvgContext ctx, float x, float y){ if (_check_point_array(ctx)) return; - if (isnanf(x) || isnanf(y)) { + if (isnan(x) || isnan(y)) { LOG(VKVG_LOG_DEBUG, "_add_point: (%f, %f)\n", x, y); return; } @@ -1487,7 +1487,7 @@ void _elliptic_arc (VkvgContext ctx, float x1, float y1, float x2, float y2, boo vec2 u = vec2_unit_x; vec2 v = {(p1.x-cp.x)/rx, (p1.y-cp.y)/ry}; double sa = acosf (vec2_dot (u, v) / (fabsf(vec2_length(v)) * fabsf(vec2_length(u)))); - if (isnanf(sa)) + if (isnan(sa)) sa=M_PIF; if (u.x*v.y-u.y*v.x < 0) sa = -sa; @@ -1495,7 +1495,7 @@ void _elliptic_arc (VkvgContext ctx, float x1, float y1, float x2, float y2, boo u = v; v = (vec2) {(-p1.x-cp.x)/rx, (-p1.y-cp.y)/ry}; double delta_theta = acosf (vec2_dot (u, v) / (fabsf(vec2_length (v)) * fabsf(vec2_length (u)))); - if (isnanf(delta_theta)) + if (isnan(delta_theta)) delta_theta=M_PIF; if (u.x*v.y-u.y*v.x < 0) delta_theta = -delta_theta; |