Skip to content

Commit 49387aa

Browse files
committed
emit >>0 in HEAP8, for consistency with HEAP16|32
1 parent 875c2a2 commit 49387aa

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/parseTools.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -1168,15 +1168,10 @@ function getHeapOffset(offset, type, forceAsm) {
11681168
var sz = Runtime.getNativeTypeSize(type);
11691169
var shifts = Math.log(sz)/Math.LN2;
11701170
offset = '(' + offset + ')';
1171-
if (shifts != 0) {
1172-
if (CHECK_HEAP_ALIGN) {
1173-
return '((CHECK_ALIGN_' + sz + '(' + offset + '|0)|0)>>' + shifts + ')';
1174-
} else {
1175-
return '(' + offset + '>>' + shifts + ')';
1176-
}
1171+
if (CHECK_HEAP_ALIGN && shifts > 0) {
1172+
return '((CHECK_ALIGN_' + sz + '(' + offset + '|0)|0)>>' + shifts + ')';
11771173
} else {
1178-
// we need to guard against overflows here, HEAP[U]8 expects a guaranteed int
1179-
return isJSVar(offset) ? offset : '(' + offset + '|0)';
1174+
return '(' + offset + '>>' + shifts + ')';
11801175
}
11811176
}
11821177

0 commit comments

Comments
 (0)