diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-30 11:03:59 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-30 11:21:40 -0700 |
commit | abe3dbef68bf5e71894e2fe514ac263eaf125224 (patch) | |
tree | cade070341b3590c2f9a48039ca0674c0a5036fb /src | |
parent | 69b39b965f0b27cd1fd51c66eb94b0a8ac540021 (diff) |
handle illegal mathops in processMathop; valid for <64 bits in some cases
Diffstat (limited to 'src')
-rw-r--r-- | src/parseTools.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 45046558..090d85ac 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -2038,12 +2038,19 @@ function processMathop(item) { } var bitsBefore = parseInt((item.params[0] ? item.params[0].type : item.type).substr(1)); // remove i to leave the number of bits left after this var bitsLeft = parseInt(((item.params[1] && item.params[1].ident) ? item.params[1].ident : item.type).substr(1)); // remove i to leave the number of bits left after this operation + var rawBits = getBits(item.type); + assert(rawBits <= 64); function integerizeBignum(value) { return makeInlineCalculation('VALUE-VALUE%1', value, 'tempBigIntI'); } - if ((type == 'i64' || paramTypes[0] == 'i64' || paramTypes[1] == 'i64' || idents[1] == '(i64)') && USE_TYPED_ARRAYS == 2) { + if ((type == 'i64' || paramTypes[0] == 'i64' || paramTypes[1] == 'i64' || idents[1] == '(i64)' || rawBits > 32) && USE_TYPED_ARRAYS == 2) { + // this code assumes i64 for the most part + if (ASSERTIONS && rawBits < 64) { + warnOnce('processMathop processing illegal non-i64 value: ' + [type, paramTypes, idents]) + } + var warnI64_1 = function() { warnOnce('Arithmetic on 64-bit integers in mode 1 is rounded and flaky, like mode 0!'); }; |