aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-30 12:24:36 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-02 17:31:37 -0700
commit3f03cd8e921afe0449e36df7e3b8272ad29e0b11 (patch)
tree7651d37dad3fc9cb3e36685e80e435ad2bcfad03 /src/parseTools.js
parentcae8a52b4958aaae7231e0ae25552abb9d543525 (diff)
overflow numbers directly in js compiler
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 49664170..adde8d63 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1901,8 +1901,10 @@ function handleOverflow(text, bits) {
if (CHECK_OVERFLOWS) return 'CHECK_OVERFLOW(' + text + ', ' + bits + ', ' + Math.floor(correctSpecificOverflow()) + ')';
if (!correct) return text;
if (bits == 32) {
+ if (isNumber(text)) return text | 0;
return '((' + text + ')|0)';
} else if (bits < 32) {
+ if (isNumber(text)) return text & (Math.pow(2, bits) - 1);
return '((' + text + ')&' + (Math.pow(2, bits) - 1) + ')';
} else {
return text; // We warned about this earlier