Bug 720094 - Simplify the implementation of JSDOUBLE_IS_NaN a bit, consolidating two implementations (conditioned on the architecture) into one. r=dvander
authorJeff Walden <jwalden@mit.edu>
Fri, 20 Jan 2012 23:39:32 -0800
changeset 86362 0049666222dee49144171edc40da978cd78db2ba
parent 86361 1efdc864bce257b69b8aab23baee4a1a75217f78
child 86363 92844ace31ecdde9d47950ebcd5e5ee9c9630b2d
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs720094
milestone12.0a1
Bug 720094 - Simplify the implementation of JSDOUBLE_IS_NaN a bit, consolidating two implementations (conditioned on the architecture) into one. r=dvander
js/src/jsnum.h
--- a/js/src/jsnum.h
+++ b/js/src/jsnum.h
@@ -87,21 +87,18 @@ typedef union jsdpun {
     jsdouble d;
 } jsdpun;
 
 static inline int
 JSDOUBLE_IS_NaN(jsdouble d)
 {
     jsdpun u;
     u.d = d;
-#if defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)
-    return (u.u64 & ~JSDOUBLE_SIGNBIT) > JSDOUBLE_EXPMASK;
-#else
-    return (u.s.hi & JSDOUBLE_HI32_NAN) == JSDOUBLE_HI32_NAN;
-#endif
+    return (u.u64 & JSDOUBLE_EXPMASK) == JSDOUBLE_EXPMASK &&
+           (u.u64 & JSDOUBLE_MANTMASK) != 0;
 }
 
 static inline int
 JSDOUBLE_IS_FINITE(jsdouble d)
 {
     /* -0 is finite. NaNs are not. */
     jsdpun u;
     u.d = d;