summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/nan.cpp35
-rw-r--r--compat/nan.hpp11
-rw-r--r--tracker-pt/point_tracker.cpp15
-rw-r--r--tracker-udp/ftnoir_tracker_udp.cpp7
4 files changed, 13 insertions, 55 deletions
diff --git a/compat/nan.cpp b/compat/nan.cpp
deleted file mode 100644
index 037efbe1..00000000
--- a/compat/nan.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "export.hpp"
-
-#include "compat/macros.hpp"
-
-#if defined(_MSC_VER)
-# include <float.h>
-# include <math.h>
-# define my_isnan ::_isnan
-# define my_isinf ::isinf
-#elif defined __MINGW32__
-
-static int __cdecl my_isnan(double)__asm__("__isnan");
-static int __cdecl my_fpclassify(double)__asm__("___fpclassify");
-
-#define FP_NAN 0x0100
-#define FP_NORMAL 0x0400
-#define FP_INFINITE (FP_NAN | FP_NORMAL)
-#define FP_ZERO 0x4000
-#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO)
-
-#define my_isinf(x) (my_fpclassify(x) == FP_INFINITE)
-
-#elif defined __APPLE__
-# include <math.h>
-# define my_isnan(x) isnan(x)
-# define my_isinf(x) isinf(x)
-#else
-int my_isnan(double)__asm__("isnan");
-int my_isinf(double)__asm__("isinf");
-
-#endif
-OTR_COMPAT_EXPORT never_inline bool nanp(double x)
-{
- return my_isnan(x) || my_isinf(x);
-}
diff --git a/compat/nan.hpp b/compat/nan.hpp
deleted file mode 100644
index 0361367b..00000000
--- a/compat/nan.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include "export.hpp"
-
-#if defined(__GNUC__)
-OTR_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double value);
-#elif defined(_WIN32)
-OTR_COMPAT_EXPORT __declspec(noinline) bool nanp(double value);
-#else
-OTR_COMPAT_EXPORT bool nanp(double value);
-#endif
diff --git a/tracker-pt/point_tracker.cpp b/tracker-pt/point_tracker.cpp
index 56a029fe..5efbbfe8 100644
--- a/tracker-pt/point_tracker.cpp
+++ b/tracker-pt/point_tracker.cpp
@@ -6,7 +6,6 @@
*/
#include "point_tracker.h"
-#include "compat/nan.hpp"
#include "compat/math-imports.hpp"
using namespace types;
@@ -372,18 +371,24 @@ int PointTracker::POSIT(const PointModel& model, const PointOrder& order, f foca
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
- if (nanp(r(i, j)))
+ {
+ int ret = std::fpclassify(r(i, j));
+ if (ret == FP_NAN || ret == FP_INFINITE)
{
- qDebug() << "posit nan";
+ qDebug() << "posit nan -- R";
return -1;
}
+ }
for (unsigned i = 0; i < 3; i++)
- if (nanp(t[i]))
+ {
+ int ret = std::fpclassify(t[i]);
+ if (ret == FP_NAN || ret == FP_INFINITE)
{
- qDebug() << "posit nan";
+ qDebug() << "posit nan -- T";
return -1;
}
+ }
// apply results
X_CM.R = r;
diff --git a/tracker-udp/ftnoir_tracker_udp.cpp b/tracker-udp/ftnoir_tracker_udp.cpp
index fd627ae1..318683f7 100644
--- a/tracker-udp/ftnoir_tracker_udp.cpp
+++ b/tracker-udp/ftnoir_tracker_udp.cpp
@@ -8,8 +8,8 @@
#include "ftnoir_tracker_udp.h"
#include "api/plugin-api.hpp"
-#include "compat/nan.hpp"
+#include <cmath>
#include <iterator>
udp::udp() :
@@ -48,10 +48,9 @@ void udp::run()
progn(
for (unsigned i = 0; i < 6; i++)
{
- if (nanp(last_recv_pose2[i]))
- {
+ int val = std::fpclassify(last_recv_pose2[i]);
+ if (val == FP_NAN || val == FP_INFINITE)
return false;
- }
}
return true;
))