aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parseTools.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 3c2eeece..08cf9b60 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -2058,7 +2058,7 @@ function makeSignOp(value, type, op, force, ignore) {
if (isPointerType(type)) type = 'i32'; // Pointers are treated as 32-bit ints
if (!value) return value;
var bits, full;
- if (type in Runtime.INT_TYPES) {
+ if (type[0] === 'i') {
bits = parseInt(type.substr(1));
full = op + 'Sign(' + value + ', ' + bits + ', ' + Math.floor(ignore || correctSpecificSign()) + ')';
// Always sign/unsign constants at compile time, regardless of CHECK/CORRECT
@@ -2067,7 +2067,7 @@ function makeSignOp(value, type, op, force, ignore) {
}
}
if ((ignore || !correctSigns()) && !CHECK_SIGNS && !force) return value;
- if (type in Runtime.INT_TYPES) {
+ if (type[0] === 'i') {
// this is an integer, but not a number (or we would have already handled it)
// shortcuts
if (!CHECK_SIGNS || ignore) {
@@ -2455,6 +2455,11 @@ function processMathop(item) {
// TODO: We sometimes generate false instead of 0, etc., in the *cmps. It seemed slightly faster before, but worth rechecking
// Note that with typed arrays, these become 0 when written. So that is a potential difference with non-typed array runs.
case 'icmp': {
+ // unsigned coercions can be (X&Y), which is not a valid asm coercion for comparisons
+ if (ASM_JS && variant[0] === 'u') {
+ if (idents[0].indexOf('>>>') < 0) idents[0] = '((' + idents[0] + ')>>>0)';
+ if (idents[1].indexOf('>>>') < 0) idents[1] = '((' + idents[1] + ')>>>0)';
+ }
switch (variant) {
case 'uge': case 'sge': return idents[0] + '>=' + idents[1];
case 'ule': case 'sle': return idents[0] + '<=' + idents[1];