Skip to content

Commit

Permalink
Bug 461192: Rename fd_copysign to js_copysign. r=jorendorff
Browse files Browse the repository at this point in the history
Since we're no longer using fdlibm, it doesn't make sense to use
fd_copysign as the name of SpiderMonkey's appropriately chosen version
of copysign.  js_copysign seems more appropriate.
  • Loading branch information
Jim Blandy committed Oct 22, 2008
1 parent 4b51f42 commit ca2234d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions js/src/jslibmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@

/* The right copysign function is not always named the same thing. */
#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#define fd_copysign __builtin_copysign
#define js_copysign __builtin_copysign
#elif defined WINCE
#define fd_copysign _copysign
#define js_copysign _copysign
#elif defined _WIN32
#if _MSC_VER < 1400
/* Try to work around apparent _copysign bustage in VC6 and VC7. */
#define fd_copysign js_copysign
#define js_copysign js_copysign
extern double js_copysign(double, double);
#else
#define fd_copysign _copysign
#define js_copysign _copysign
#endif
#else
#define fd_copysign copysign
#define js_copysign copysign
#endif

#endif /* _LIBMATH_H */
Expand Down
12 changes: 6 additions & 6 deletions js/src/jsmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ math_atan2(JSContext *cx, uintN argc, jsval *vp)
* - The sign of y determines the multiplicator, 1 or 3.
*/
if (JSDOUBLE_IS_INFINITE(x) && JSDOUBLE_IS_INFINITE(y)) {
z = fd_copysign(M_PI / 4, x);
z = js_copysign(M_PI / 4, x);
if (y < 0)
z *= 3;
return js_NewDoubleInRootedValue(cx, z, vp);
Expand All @@ -213,7 +213,7 @@ math_atan2(JSContext *cx, uintN argc, jsval *vp)
#if defined(SOLARIS) && defined(__GNUC__)
if (x == 0) {
if (JSDOUBLE_IS_NEGZERO(y)) {
z = fd_copysign(M_PI, x);
z = js_copysign(M_PI, x);
return js_NewDoubleInRootedValue(cx, z, vp);
}
if (y == 0) {
Expand Down Expand Up @@ -344,7 +344,7 @@ math_max(JSContext *cx, uintN argc, jsval *vp)
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
return JS_TRUE;
}
if (x == 0 && x == z && fd_copysign(1.0, z) == -1)
if (x == 0 && x == z && js_copysign(1.0, z) == -1)
z = x;
else
/*
Expand Down Expand Up @@ -378,7 +378,7 @@ math_min(JSContext *cx, uintN argc, jsval *vp)
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
return JS_TRUE;
}
if (x == 0 && x == z && fd_copysign(1.0,x) == -1)
if (x == 0 && x == z && js_copysign(1.0,x) == -1)
z = x;
else
z = (x < z) ? x : z;
Expand Down Expand Up @@ -532,7 +532,7 @@ math_round(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_copysign(floor(x + 0.5), x);
z = js_copysign(floor(x + 0.5), x);
return js_NewNumberInRootedValue(cx, z, vp);
}

Expand Down Expand Up @@ -623,7 +623,7 @@ js_Math_max(jsdouble d, jsdouble p)
if (JSDOUBLE_IS_NaN(d) || JSDOUBLE_IS_NaN(p))
return js_NaN;

if (p == 0 && p == d && fd_copysign(1.0, d) == -1)
if (p == 0 && p == d && js_copysign(1.0, d) == -1)
return p;
return (d > p) ? d : p;
}
Expand Down

0 comments on commit ca2234d

Please sign in to comment.