add specialized StringToInt32 and filter for it
This commit is contained in:
@@ -239,7 +239,7 @@ builtin_EqualStrings(JSString* str1, JSString* str2)
|
||||
}
|
||||
|
||||
jsdouble FASTCALL
|
||||
builtin_StringToNumber(JSContext* cx, JSString *str)
|
||||
builtin_StringToNumber(JSContext* cx, JSString* str)
|
||||
{
|
||||
const jschar* bp;
|
||||
const jschar* end;
|
||||
@@ -256,6 +256,20 @@ builtin_StringToNumber(JSContext* cx, JSString *str)
|
||||
return d;
|
||||
}
|
||||
|
||||
jsint FASTCALL
|
||||
builtin_StringToInt32(JSContext* cx, JSString* str)
|
||||
{
|
||||
const jschar* bp;
|
||||
const jschar* end;
|
||||
const jschar* ep;
|
||||
jsdouble d;
|
||||
|
||||
JSSTRING_CHARS_AND_END(str, bp, end);
|
||||
if (!js_strtod(cx, bp, end, &ep, &d) || js_SkipWhiteSpace(ep, end) != end)
|
||||
return 0;
|
||||
return (jsint)d;
|
||||
}
|
||||
|
||||
#define LO ARGSIZE_LO
|
||||
#define F ARGSIZE_F
|
||||
#define Q ARGSIZE_Q
|
||||
|
||||
Reference in New Issue
Block a user