On 3/20/2013 12:56 PM, Allen Wirfs-Brock wrote:
If you're specifically talking about reading/writing TypedArray
elements (really ArrayBuffers) you have to take into account the
possibility that you can have different types overlaying the same
buffer storage. Hence a NaN bit pattern might be written as 2 Uint32
values and then retrieved as a Float64 value. In that case, there is
no Float64 write to perform the normalization so it must be done on
all reads. Such normalization is especially important if object
pointers are represented using NaN-boxing.
Allen
Exactly, you can't control it on the write end. Writing two uint32's is
precisely how you do NaN-tagging using typed arrays (since you can't
write an uint64). The way to normalize is to coerce to a single
canonical NaN on read, if anything.
(an example of NaN-tagging using typed arrays:
https://gist.github.com/Benvie/5021724)
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss