Harking back to this, I've belatedly noticed that the tagged versions of 
subVec, subArr, and update all take the supplied index and use it directly in 
the Word8 array, when they should be multiplying it by bytesPerElem. The 
double-precision and boxed versions have this right, but as it stands the 
tagged version is only capable of retrieving or updating the first value in the 
array correctly.

Multiplying i by bytesPerElem in each case fixes this, i.e. doing something 
like this in all six of the tagged functions:

         fun update(v, i, r) =
         let
             val w: word = r32AsWord r
+            val i = i * bytesPerElem
             open Word8Array

... but I notice the double/boxed version has some more logic to check the int 
is within range, so perhaps there is a more appropriate fix.


Chris
_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to