From ca94da1513658a208f32ccff11ed28ff9a9fafb3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <info@florianmaerkl.de>
Date: Tue, 12 May 2020 21:17:00 +0200
Subject: [PATCH 13/23] Fix Build with G++ 4.9.2

---
 .../Decompiler/src/decompile/cpp/float.cc     | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc
index 1af9b5d79..9b044d0c1 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc
@@ -19,6 +19,38 @@
 #include <cmath>
 #include "address.hh"
 
+#if defined(_WINDOWS) && !defined(INFINITY)
+
+// Some definitions for Windows floating point stuff
+#include <cfloat>
+
+inline int4 signbit(double x) {
+  return (((_fpclass(x)& (_FPCLASS_NINF | _FPCLASS_NN
+			  | _FPCLASS_ND | _FPCLASS_NZ))!=0) ? 1 : 0);
+}
+
+inline int4 isnan(double x) {
+  return (((_fpclass(x)& (_FPCLASS_SNAN | _FPCLASS_QNAN))!=0) ? 1 : 0);
+}
+
+inline int4 isinf(double x) {
+  int4 classify = _fpclass(x);
+  if (classify == _FPCLASS_NINF) return -1;
+  if (classify == _FPCLASS_PINF) return 1;
+  return 0;
+}
+
+#define INFINITY HUGE_VAL
+#define NAN (INFINITY/INFINITY)
+
+#else
+
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891
+#define isnan std::isnan
+#define isinf std::isinf
+
+#endif
+
 /// Set format for a given encoding size according to IEEE 754 standards
 /// \param sz is the size of the encoding in bytes
 FloatFormat::FloatFormat(int4 sz)
-- 
2.24.3 (Apple Git-128)

