lightspark/lightspark — Issue #154: Correct {U}Integer overflow behavior
Author: mgehre
Created: 2011-11-04 14:14:22+00:00
State: open

Arithmetic operations on {U}Integers should be carried out after converting them to Numbers. For example

var i1:uint = UINT_MAX;
var i2:uint = 1;
trace(i1+i2);

will not trace '-1', but UINT_MAX+1 and the result will be of type Number (not uint!).

It is still not clear how to generate the fastest code for that. Either
1) convert all {U}Integer to double and operate on them
2) operate on the integer value and just convert them if a overflow occurs

See also the last two paragraphs of https://mail.mozilla.org/pipermail/tamarin-devel/2009-November/001252.html