mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Work around MSVC6/7.1 copysign bustage (329383, tachyonal r=mrbkap).
This commit is contained in:
parent
728330ed20
commit
61309696b5
@ -77,8 +77,14 @@
|
|||||||
/* The right copysign function is not always named the same thing. */
|
/* The right copysign function is not always named the same thing. */
|
||||||
#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||||
#define fd_copysign __builtin_copysign
|
#define fd_copysign __builtin_copysign
|
||||||
#elif (defined _WIN32 && !defined WINCE)
|
#elif defined _WIN32 && !defined WINCE
|
||||||
|
#if _MSC_VER < 1400
|
||||||
|
/* Try to work around apparent _copysign bustage in VC6 and VC7. */
|
||||||
|
#define fd_copysign js_copysign
|
||||||
|
extern double js_copysign(double, double);
|
||||||
|
#else
|
||||||
#define fd_copysign _copysign
|
#define fd_copysign _copysign
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define fd_copysign copysign
|
#define fd_copysign copysign
|
||||||
#endif
|
#endif
|
||||||
|
@ -241,7 +241,7 @@ math_max(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||||||
*rval = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
*rval = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
if ((x==0)&&(x==z)&&(fd_copysign(1.0,z)==-1))
|
if (x == 0 && x == z && fd_copysign(1.0, z) == -1)
|
||||||
z = x;
|
z = x;
|
||||||
else
|
else
|
||||||
z = (x > z) ? x : z;
|
z = (x > z) ? x : z;
|
||||||
@ -266,7 +266,7 @@ math_min(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||||||
*rval = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
*rval = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
if ((x==0)&&(x==z)&&(fd_copysign(1.0,x)==-1))
|
if (x == 0 && x == z && fd_copysign(1.0,x) == -1)
|
||||||
z = x;
|
z = x;
|
||||||
else
|
else
|
||||||
z = (x < z) ? x : z;
|
z = (x < z) ? x : z;
|
||||||
@ -384,6 +384,21 @@ math_random(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||||||
return js_NewNumberValue(cx, z, rval);
|
return js_NewNumberValue(cx, z, rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined _WIN32 && !defined WINCE && _MSC_VER < 1400
|
||||||
|
/* Try to work around apparent _copysign bustage in VC6 and VC7. */
|
||||||
|
double
|
||||||
|
js_copysign(double x, double y)
|
||||||
|
{
|
||||||
|
jsdpun xu, yu;
|
||||||
|
|
||||||
|
xu.d = x;
|
||||||
|
yu.d = y;
|
||||||
|
xu.s.hi &= ~JSDOUBLE_HI32_SIGNBIT;
|
||||||
|
xu.s.hi |= yu.s.hi & JSDOUBLE_HI32_SIGNBIT;
|
||||||
|
return xu.d;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
math_round(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
math_round(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user