Typed array sizes overestimated
romainbar opened this issue · comments
romainbar commented
let a = new Uint8Array(50);
sizeof(a); // 580
a.length; // 50
Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array... need be detected.
Such as:
if (a.constructor === Int8Array || a.constructor === Uint8Array || a.constructor === Uint8ClampedArray
|| a.constructor === Int16Array || a.constructor === Uint16Array)
{
size = a.BYTES_PER_ELEMENT * a.length;
}
martin19 commented
@miktam will the changes of @daneren2005 (daneren2005@21428d8) be merged? this is a useful contribution.
Andrei Karpuszonak commented
@ martin19, it seems useful.
@daneren2005, could you make a PR, please?
martin19 commented
awesome, thanks!