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;
|
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
|
JSBool
|
||||||
js_strtod(JSContext *cx, const jschar *s, const jschar *send,
|
js_strtod(JSContext *cx, const jschar *s, const jschar *send,
|
||||||
const jschar **ep, jsdouble *dp)
|
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.
|
* 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.
|
* If d is NaN, return 0. If d is an infinity, return it without conversion.
|
||||||
*/
|
*/
|
||||||
extern jsdouble
|
static inline jsdouble
|
||||||
js_DoubleToInteger(jsdouble d);
|
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
|
* Similar to strtod except that it replaces overflows with infinities of the
|
||||||
|
@ -523,11 +523,11 @@ static inline bool
|
|||||||
JS_ISSPACE(jschar c)
|
JS_ISSPACE(jschar c)
|
||||||
{
|
{
|
||||||
uint32 w = uint32(c);
|
uint32 w = uint32(c);
|
||||||
if (w < 256) {
|
|
||||||
|
if (w < 256)
|
||||||
return w <= ' ' && (w == ' ' || (9 <= w && w <= 0xD));
|
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))
|
#define JS_ISPRINT(c) ((c) < 128 && isprint(c))
|
||||||
|
Loading…
Reference in New Issue
Block a user