[Public WebGL] Differing TypedArray#set behavior

Boris Zbarsky [email protected]
Thu Apr 12 11:22:27 PDT 2012


On 4/12/12 4:57 AM, Stéphan Kochen wrote:
>
> While implementing TypedArrays, I came across a specific situation
> that seems to be missed by the conformance tests. Here's a test:
>
>    https://github.com/stephank/node-arrays/blob/master/test/typed-array-copy.js
>
> This does a copy using `TypedArray#set` between two TypedArrays of
> different types, but with the same backing store and overlapping
> regions.
>
> The test passes on Firefox, but fails on Chrome, Safari, Opera and Node.js.
>
> Is the Firefox behavior the correct one here?

The spec at http://www.khronos.org/registry/typedarray/specs/latest/ says:

   If the input array is a TypedArray, the two arrays may use the same
   underlying ArrayBuffer. In this situation, setting the values takes
   place as if all the data is first copied into a temporary buffer that
   does not overlap either of the arrays, and then the data from the
   temporary buffer is copied into the current array.

So in your test, that should lead to a[0] == a[1] == 5, and the Firefox 
behavior is correct.  Would you mind filing bugs on JSC and V8 and Opera 
here?

-Boris


-----------------------------------------------------------
You are currently subscribed to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------





More information about the public_webgl mailing list