mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Inline js_DoubleToInteger (513436, r=sayrer).
This commit is contained in:
parent
7a4da2ecd3
commit
6424c04026
@ -1124,23 +1124,6 @@ js_ValueToUint16(JSContext *cx, jsval *vp)
|
||||
return u;
|
||||
}
|
||||
|
||||
jsdouble
|
||||
js_DoubleToInteger(jsdouble d)
|
||||
{
|
||||
JSBool neg;
|
||||
|
||||
if (d == 0)
|
||||
return d;
|
||||
if (!JSDOUBLE_IS_FINITE(d)) {
|
||||
if (JSDOUBLE_IS_NaN(d))
|
||||
return 0;
|
||||
return d;
|
||||
}
|
||||
neg = (d < 0);
|
||||
d = floor(neg ? -d : d);
|
||||
return neg ? -d : d;
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_strtod(JSContext *cx, const jschar *s, const jschar *send,
|
||||
const jschar **ep, jsdouble *dp)
|
||||
|
@ -368,8 +368,23 @@ js_ValueToUint16(JSContext *cx, jsval *vp);
|
||||
* Convert a jsdouble to an integral number, stored in a jsdouble.
|
||||
* If d is NaN, return 0. If d is an infinity, return it without conversion.
|
||||
*/
|
||||
extern jsdouble
|
||||
js_DoubleToInteger(jsdouble d);
|
||||
static inline jsdouble
|
||||
js_DoubleToInteger(jsdouble d)
|
||||
{
|
||||
if (d == 0)
|
||||
return d;
|
||||
|
||||
if (!JSDOUBLE_IS_FINITE(d)) {
|
||||
if (JSDOUBLE_IS_NaN(d))
|
||||
return 0;
|
||||
return d;
|
||||
}
|
||||
|
||||
JSBool neg = (d < 0);
|
||||
d = floor(neg ? -d : d);
|
||||
|
||||
return neg ? -d : d;
|
||||
}
|
||||
|
||||
/*
|
||||
* Similar to strtod except that it replaces overflows with infinities of the
|
||||
|
@ -523,11 +523,11 @@ static inline bool
|
||||
JS_ISSPACE(jschar c)
|
||||
{
|
||||
uint32 w = uint32(c);
|
||||
if (w < 256) {
|
||||
|
||||
if (w < 256)
|
||||
return w <= ' ' && (w == ' ' || (9 <= w && w <= 0xD));
|
||||
} else {
|
||||
return (JS_CCODE(w) & 0x00070000) == 0x00040000;
|
||||
}
|
||||
|
||||
return (JS_CCODE(w) & 0x00070000) == 0x00040000;
|
||||
}
|
||||
|
||||
#define JS_ISPRINT(c) ((c) < 128 && isprint(c))
|
||||
|
Loading…
Reference in New Issue
Block a user