[Public WebGL] Differing TypedArray#set behavior

Glenn Maynard [email protected]
Fri Apr 13 07:01:36 PDT 2012

2012/4/13 Stéphan Kochen <[email protected]>

> I was more surprised mixing type was allowed like this, and I suppose it's
> because it also accepts a plain Array. If it weren't for that, everyone
> would simply be calling memmove().

It's not actually like memcpy/memmove, because of the conversion that
happens if the types are different.  It's only memmove if the types happen
to be the same.

As an aside, it doesn't seem like the conversion is actually defined, eg.
if you set() an Int16Array onto an Int8Array and some values overflow.  I'm
not sure where the conversion is defined even for eg. array8[0] = 2000
(somewhere in WebIDL, I assume), but set() should use the same rules.

Glenn Maynard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20120413/2de87502/attachment.html>

More information about the public_webgl mailing list