зеркало из https://github.com/mozilla/pjs.git
Expose public APIs for converting doubles to signed/unsigned int per ECMA spec (bug 631132, r=bzbarsky).
This commit is contained in:
Родитель
5d3438c3ac
Коммит
8544587944
|
@ -520,6 +520,18 @@ JS_DoubleIsInt32(jsdouble d, jsint *ip)
|
|||
return JSDOUBLE_IS_INT32(d, (int32_t *)ip);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(int32)
|
||||
JS_DoubleToInt32(jsdouble d)
|
||||
{
|
||||
return js_DoubleToECMAInt32(d);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(uint32)
|
||||
JS_DoubleToUint32(jsdouble d)
|
||||
{
|
||||
return js_DoubleToECMAUint32(d);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_ValueToECMAInt32(JSContext *cx, jsval v, int32 *ip)
|
||||
{
|
||||
|
|
|
@ -664,6 +664,12 @@ JS_ValueToNumber(JSContext *cx, jsval v, jsdouble *dp);
|
|||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_DoubleIsInt32(jsdouble d, jsint *ip);
|
||||
|
||||
extern JS_PUBLIC_API(int32)
|
||||
JS_DoubleToInt32(jsdouble d);
|
||||
|
||||
extern JS_PUBLIC_API(uint32)
|
||||
JS_DoubleToUint32(jsdouble d);
|
||||
|
||||
/*
|
||||
* Convert a value to a number, then to an int32, according to the ECMA rules
|
||||
* for ToInt32.
|
||||
|
|
Загрузка…
Ссылка в новой задаче