Bug 461192: Drop fd_ prefix from math functions. r=jorendorff

The Mozilla tree used to optionally use its own math library, fdlibm.
For each standard math function FOO, fdlibm defined its own version
named fd_FOO.  The SpiderMonkey sources called the fd_FOO functions
directly.  In configurations where fdlibm was not used, jslibmath.h
#defined fd_FOO to expand to FOO, resulting in references to the
standard math library's functions.

Now that fdlibm is not used, even optionally, those fd_ prefixes are
unnecessary.  However, some code is still needed to choose the right
copysign function, so jslibmath.h still has a reason to exist.
This commit is contained in:
Jim Blandy 2008-10-22 14:52:14 -07:00
Родитель 8120c230e1
Коммит 4b51f4264e
3 изменённых файлов: 16 добавлений и 33 удалений

Просмотреть файл

@ -389,7 +389,7 @@ JS_dtobasestr(int base, double dinput)
LOCK_DTOA();
/* Output the integer part of d with the digits in reverse order. */
pInt = p;
dval(di) = fd_floor(dval(d));
dval(di) = floor(dval(d));
if (dval(di) <= 4294967295.0) {
uint32 n = (uint32)dval(di);
if (n)

Просмотреть файл

@ -48,12 +48,6 @@
* Use system provided math routines.
*/
#define fd_acos acos
#define fd_asin asin
#define fd_atan atan
#define fd_atan2 atan2
#define fd_ceil ceil
/* The right copysign function is not always named the same thing. */
#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#define fd_copysign __builtin_copysign
@ -71,16 +65,5 @@ extern double js_copysign(double, double);
#define fd_copysign copysign
#endif
#define fd_cos cos
#define fd_exp exp
#define fd_fabs fabs
#define fd_floor floor
#define fd_fmod fmod
#define fd_log log
#define fd_pow pow
#define fd_sin sin
#define fd_sqrt sqrt
#define fd_tan tan
#endif /* _LIBMATH_H */

Просмотреть файл

@ -115,7 +115,7 @@ math_abs(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_fabs(x);
z = fabs(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -137,7 +137,7 @@ math_acos(JSContext *cx, uintN argc, jsval *vp)
return JS_TRUE;
}
#endif
z = fd_acos(x);
z = acos(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -159,7 +159,7 @@ math_asin(JSContext *cx, uintN argc, jsval *vp)
return JS_TRUE;
}
#endif
z = fd_asin(x);
z = asin(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -175,7 +175,7 @@ math_atan(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_atan(x);
z = atan(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -222,7 +222,7 @@ math_atan2(JSContext *cx, uintN argc, jsval *vp)
}
}
#endif
z = fd_atan2(x, y);
z = atan2(x, y);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -238,7 +238,7 @@ math_ceil(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_ceil(x);
z = ceil(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -254,7 +254,7 @@ math_cos(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_cos(x);
z = cos(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -282,7 +282,7 @@ math_exp(JSContext *cx, uintN argc, jsval *vp)
}
}
#endif
z = fd_exp(x);
z = exp(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -298,7 +298,7 @@ math_floor(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_floor(x);
z = floor(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -320,7 +320,7 @@ math_log(JSContext *cx, uintN argc, jsval *vp)
return JS_TRUE;
}
#endif
z = fd_log(x);
z = log(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -414,7 +414,7 @@ math_pow(JSContext *cx, uintN argc, jsval *vp)
*vp = JSVAL_ONE;
return JS_TRUE;
}
z = fd_pow(x, y);
z = pow(x, y);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -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(fd_floor(x + 0.5), x);
z = fd_copysign(floor(x + 0.5), x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -548,7 +548,7 @@ math_sin(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_sin(x);
z = sin(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -564,7 +564,7 @@ math_sqrt(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_sqrt(x);
z = sqrt(x);
return js_NewNumberInRootedValue(cx, z, vp);
}
@ -580,7 +580,7 @@ math_tan(JSContext *cx, uintN argc, jsval *vp)
x = js_ValueToNumber(cx, &vp[2]);
if (JSVAL_IS_NULL(vp[2]))
return JS_FALSE;
z = fd_tan(x);
z = tan(x);
return js_NewNumberInRootedValue(cx, z, vp);
}