diff --git a/src/MPL_isnan.h b/src/MPL_isnan.h deleted file mode 100644 index 61723dc575d1..000000000000 --- a/src/MPL_isnan.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - -These definitions were inspired by and originally modified from -numarray's Include/numarray/nummacro.h - -The "64" below refers to double precision floating point numbers. This -code only works on doubles. - -*/ - -#ifdef _ISOC99_SOURCE -#include -#endif - -#if defined(_MSC_VER) -typedef __int64 MPL_Int64; -#else -#if defined(_ISOC99_SOURCE) -typedef int64_t MPL_Int64; -#else -typedef long long MPL_Int64; -#endif -#endif - -#if !defined(MPL_U64) -#define MPL_U64(u) (* (MPL_Int64 *) &(u) ) -#endif /* MPL_U64 */ - -#if !defined(MPL_isnan64) -#if !defined(_MSC_VER) -#define MPL_isnan64(u) \ - ( (( MPL_U64(u) & 0x7ff0000000000000LL) == 0x7ff0000000000000LL) && ((MPL_U64(u) & 0x000fffffffffffffLL) != 0)) ? 1:0 -#else -#define MPL_isnan64(u) \ - ( (( MPL_U64(u) & 0x7ff0000000000000i64) == 0x7ff0000000000000i64) && ((MPL_U64(u) & 0x000fffffffffffffi64) != 0)) ? 1:0 -#endif -#endif /* MPL_isnan64 */ - -#if !defined(MPL_isinf64) -#if !defined(_MSC_VER) -#define MPL_isinf64(u) \ - ( (( MPL_U64(u) & 0x7ff0000000000000LL) == 0x7ff0000000000000LL) && ((MPL_U64(u) & 0x000fffffffffffffLL) == 0)) ? 1:0 -#else -#define MPL_isinf64(u) \ - ( (( MPL_U64(u) & 0x7ff0000000000000i64) == 0x7ff0000000000000i64) && ((MPL_U64(u) & 0x000fffffffffffffi64) == 0)) ? 1:0 -#endif -#endif /* MPL_isinf64 */ - -#if !defined(MPL_isfinite64) -#if !defined(_MSC_VER) -#define MPL_isfinite64(u) \ - ( (( MPL_U64(u) & 0x7ff0000000000000LL) != 0x7ff0000000000000LL)) ? 1:0 -#else -#define MPL_isfinite64(u) \ - ( (( MPL_U64(u) & 0x7ff0000000000000i64) != 0x7ff0000000000000i64)) ? 1:0 -#endif -#endif /* MPL_isfinite64 */ - -#if !defined(MPL_notisfinite64) -#if !defined(_MSC_VER) -#define MPL_notisfinite64(u) \ - ( (( MPL_U64(u) & 0x7ff0000000000000LL) == 0x7ff0000000000000LL)) ? 1:0 -#else -#define MPL_notisfinite64(u) \ - ( (( MPL_U64(u) & 0x7ff0000000000000i64) == 0x7ff0000000000000i64)) ? 1:0 -#endif -#endif /* MPL_notisfinite64 */ - - diff --git a/src/_backend_agg.cpp b/src/_backend_agg.cpp index a2edfd77e13e..fba3ef71d77d 100644 --- a/src/_backend_agg.cpp +++ b/src/_backend_agg.cpp @@ -4,7 +4,6 @@ #include "_backend_agg.h" #include "mplutils.h" -#include "MPL_isnan.h" void BufferRegion::to_string_argb(uint8_t *buf) { diff --git a/src/_backend_agg.h b/src/_backend_agg.h index 798905ebcac3..b1f1b4da12d0 100644 --- a/src/_backend_agg.h +++ b/src/_backend_agg.h @@ -6,6 +6,7 @@ #ifndef __BACKEND_AGG_H__ #define __BACKEND_AGG_H__ +#include #include #include "agg_alpha_mask_u8.h" @@ -597,7 +598,7 @@ inline void RendererAgg::draw_markers(GCAgg &gc, if (has_clippath) { while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) { - if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) { + if (!(std::isfinite(x) && std::isfinite(y))) { continue; } @@ -629,7 +630,7 @@ inline void RendererAgg::draw_markers(GCAgg &gc, } } else { while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) { - if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) { + if (!(std::isfinite(x) && std::isfinite(y))) { continue; } diff --git a/src/_path.h b/src/_path.h index c19d0e5f94b4..fba77a28ef1d 100644 --- a/src/_path.h +++ b/src/_path.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "agg_conv_contour.h" #include "agg_conv_curve.h" @@ -102,7 +103,7 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins for (i = 0; i < n; ++i) { ty = points[i][1]; - if (MPL_isfinite64(ty)) { + if (std::isfinite(ty)) { // get test bit for above/below X axis yflag0[i] = (vty0 >= ty); @@ -126,7 +127,7 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins tx = points[i][0]; ty = points[i][1]; - if (MPL_notisfinite64(tx) || MPL_notisfinite64(ty)) { + if (!(std::isfinite(tx) && std::isfinite(ty))) { continue; } @@ -174,7 +175,7 @@ void point_in_path_impl(PointArray &points, PathIterator &path, ResultArray &ins tx = points[i][0]; ty = points[i][1]; - if (MPL_notisfinite64(tx) || MPL_notisfinite64(ty)) { + if (!(std::isfinite(tx) && std::isfinite(ty))) { continue; } diff --git a/src/path_converters.h b/src/path_converters.h index 77557720f054..daa7eb67b444 100644 --- a/src/path_converters.h +++ b/src/path_converters.h @@ -3,9 +3,9 @@ #ifndef __PATH_CONVERTERS_H__ #define __PATH_CONVERTERS_H__ +#include #include "agg_path_storage.h" #include "agg_clip_liang_barsky.h" -#include "MPL_isnan.h" #include "mplutils.h" #include "agg_conv_segmentator.h" @@ -176,14 +176,14 @@ class PathNanRemover : protected EmbeddedQueue<4> } size_t num_extra_points = num_extra_points_map[code & 0xF]; - bool has_nan = (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)); + bool has_nan = (!(std::isfinite(*x) && std::isfinite(*y))); queue_push(code, *x, *y); /* Note: this test can not be short-circuited, since we need to advance through the entire curve no matter what */ for (size_t i = 0; i < num_extra_points; ++i) { m_source->vertex(x, y); - has_nan = has_nan || (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)); + has_nan = has_nan || !(std::isfinite(*x) && std::isfinite(*y)); queue_push(code, *x, *y); } @@ -196,7 +196,7 @@ class PathNanRemover : protected EmbeddedQueue<4> /* If the last point is finite, we use that for the moveto, otherwise, we'll use the first vertex of the next curve. */ - if (!(MPL_notisfinite64(*x) || MPL_notisfinite64(*y))) { + if (std::isfinite(*x) && std::isfinite(*y)) { queue_push(agg::path_cmd_move_to, *x, *y); needs_move_to = false; } else { @@ -219,14 +219,14 @@ class PathNanRemover : protected EmbeddedQueue<4> return code; } - if (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)) { + if (!(std::isfinite(*x) && std::isfinite(*y))) { do { code = m_source->vertex(x, y); if (code == agg::path_cmd_stop || code == (agg::path_cmd_end_poly | agg::path_flags_close)) { return code; } - } while (MPL_notisfinite64(*x) || MPL_notisfinite64(*y)); + } while (!(std::isfinite(*x) && std::isfinite(*y))); return agg::path_cmd_move_to; }