mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=625503; convert NaN correctly with typed array array conversion; r=waldo, a=dvander
This commit is contained in:
parent
6afc30e375
commit
b4fe058f4f
@ -1116,8 +1116,12 @@ class TypedArrayTemplate
|
|||||||
if (v.isInt32())
|
if (v.isInt32())
|
||||||
return NativeType(v.toInt32());
|
return NativeType(v.toInt32());
|
||||||
|
|
||||||
if (v.isDouble())
|
if (v.isDouble()) {
|
||||||
return NativeType(v.toDouble());
|
double d = v.toDouble();
|
||||||
|
if (!ArrayTypeIsFloatingPoint() && JS_UNLIKELY(JSDOUBLE_IS_NaN(d)))
|
||||||
|
return NativeType(int32(0));
|
||||||
|
return NativeType(d);
|
||||||
|
}
|
||||||
|
|
||||||
if (v.isPrimitive() && !v.isMagic()) {
|
if (v.isPrimitive() && !v.isMagic()) {
|
||||||
jsdouble dval;
|
jsdouble dval;
|
||||||
|
@ -333,6 +333,10 @@ function test()
|
|||||||
checkThrows(function() new Float32Array(null));
|
checkThrows(function() new Float32Array(null));
|
||||||
checkThrows(function() new Float32Array(undefined));
|
checkThrows(function() new Float32Array(undefined));
|
||||||
|
|
||||||
|
// check that NaN conversions happen correctly with array conversions
|
||||||
|
check(function() (new Int32Array([NaN])[0]) == 0);
|
||||||
|
check(function() { var q = new Float32Array([NaN])[0]; return q != q; });
|
||||||
|
|
||||||
print ("done");
|
print ("done");
|
||||||
|
|
||||||
reportCompare(0, TestFailCount, "typed array tests");
|
reportCompare(0, TestFailCount, "typed array tests");
|
||||||
|
Loading…
Reference in New Issue
Block a user