edited...(and see post #10)
I expected the negative side effects... unfortunately (Chrome) browser just does not behave as (EDITED: by me misread) MDN constructor specs / doc ...
In test code new Uint8Array(buffer, begin, length).length return just the length of buffer... and on .set() it reports Uncaught RangeError: Source is too large(…).
In Chrom inspec/debug console:
> var b = new Uint8Array(10);
< undefined
> var t = new Uint8Array(5);
< undefined
> t.set(new Uint8Array(b,0,5))
X> VM380:1 Uncaught RangeError: Source is too large(…)(anonymous function) @ VM380:1
> (new Uint8Array(b,0,5)).length
< 10
Found no complaint on the Web about this violation...
Write a compiled copy function, could that help speeding up an element-wise copy?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
edited... (and see post #10)
I expected the negative side effects... unfortunately (Chrome) browser just does not behave as (EDITED: by me misread) MDN constructor specs / doc ...
In test code
new Uint8Array(buffer, begin, length).length
return just the length ofbuffer
... and on.set()
it reportsUncaught RangeError: Source is too large(…)
.In Chrom inspec/debug console:
Found no complaint on the Web about this violation...
Write a compiled copy function, could that help speeding up an element-wise copy?