Hi Chris, Thanks for pointing this out. I've committed a fix that looks like it works. It would be really helpful to have some tests for structures such as these that could be included in the test suite. Actually, generally more tests would be welcome; most of those that are there are regression tests after bug fixes.
David
On 25/04/2021 11:37, Chris Cannam wrote:
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 at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml