Handle NaN value storing in Uint8Clamped typed arrays.

TEST=mjsunit/external-array
BUG=
R=dslomov@chromium.org

Review URL: https://codereview.chromium.org/667113002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24766 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ac8b70cf
......@@ -4173,7 +4173,8 @@ typename Traits::ElementType FixedTypedArray<Traits>::from_double(
template<> inline
uint8_t FixedTypedArray<Uint8ClampedArrayTraits>::from_double(double value) {
if (value < 0) return 0;
// Handle NaNs and less than zero values which clamp to zero.
if (!(value > 0)) return 0;
if (value > 0xFF) return 0xFF;
return static_cast<uint8_t>(lrint(value));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment