Bug 513063 - Followup to fix windows breakage, r=jorendorff.
authorGraydon Hoare <graydon@mozilla.com>
Thu, 27 Aug 2009 15:54:40 -0700
changeset 32596 74e62444e779dc941d55825a8e2c62245cf8c885
parent 32595 7a48e1cea3bda093bfc8dfa0caff5e1ac8dc7b6c
child 32597 173d66a4551ad2531bd66c5fac3dab455e4cd613
push idunknown
push userunknown
push dateunknown
reviewersjorendorff
bugs513063
milestone1.9.3a1pre
Bug 513063 - Followup to fix windows breakage, r=jorendorff.
js/src/jsnum.cpp
js/src/jsnum.h
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -36,19 +36,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * JS number type and wrapper class.
  */
-#if defined(XP_WIN) || defined(XP_OS2)
-#include <float.h>
-#endif
 #ifdef XP_OS2
 #define _PC_53  PC_53
 #define _MCW_EM MCW_EM
 #define _MCW_PC MCW_PC
 #endif
 #include <locale.h>
 #include <limits.h>
 #include <math.h>
--- a/js/src/jsnum.h
+++ b/js/src/jsnum.h
@@ -35,18 +35,20 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef jsnum_h___
 #define jsnum_h___
 
+#include <math.h>
+#if defined(XP_WIN) || defined(XP_OS2)
 #include <float.h>
-#include <math.h>
+#endif
 
 /*
  * JS number (IEEE double) interface.
  *
  * JS numbers are optimistically stored in the top 31 bits of 32-bit integers,
  * but floating point literals, results that overflow 31 bits, and division and
  * modulus operands and results require a 64-bit IEEE double.  These are GC'ed
  * and pointed to by 32-bit jsvals on the stack and in object properties.
@@ -93,16 +95,27 @@ JSDOUBLE_IS_FINITE(jsdouble d)
 #ifdef WIN32
     return _finite(d);
 #else
     return finite(d);
 #endif
 }
 
 static inline int
+JSDOUBLE_IS_INFINITE(jsdouble d)
+{
+#ifdef WIN32
+    int c = _fpclass(d);
+    return c == _FPCLASS_NINF || c == _FPCLASS_PINF;
+#else
+    return isinf(d);
+#endif
+}
+
+static inline int
 JSDOUBLE_IS_NEGZERO(jsdouble d)
 {
 #ifdef WIN32
     return (d == 0 && (_fpclass(d) & _FPCLASS_NZ));
 #else
     return (d == 0 && signbit(d));
 #endif
 }