You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to downcast any integer to a lower byte signed integer the output is wrong.
trace("i16: " + (i16)(65535));
Leads to "Unknown expression type: undefined". It works as long the casted integer is in range of the int16.
A solution could be to write the unsigned version of the target integer into a ArrayBuffer using the according view, then read it again from the target type view.
var castBuffer = new ArrayBuffer(2);
var i16 = new Int16Array(castBuffer);
var u16 = new Uint16Array(castBuffer);
var i8 = new Int8Array(castBuffer);
var u8 = new Uint8Array(castBuffer);
exports.toInt16 = function (i) { u16[0] = i & 65535; return i16[0]; }
exports.toInt8 = function (i) { u8[0] = i & 255; return i8[0]; }
Downcasting float64 to float32 could be hard. I don't have a solution for this yet.
The text was updated successfully, but these errors were encountered:
If you try to downcast any integer to a lower byte signed integer the output is wrong.
Leads to "Unknown expression type: undefined". It works as long the casted integer is in range of the int16.
A solution could be to write the unsigned version of the target integer into a ArrayBuffer using the according view, then read it again from the target type view.
Downcasting float64 to float32 could be hard. I don't have a solution for this yet.
The text was updated successfully, but these errors were encountered: