WASM: fix translation of lookupswitch when min and max values differ by

more than 2^31
This commit is contained in:
Alexey Andreev 2017-04-10 21:35:02 +03:00
parent 6630175598
commit d09affce85

View File

@ -745,7 +745,7 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
WasmBlock defaultTarget = wrapper;
wrapper = defaultBlock;
if (max - min >= SWITCH_TABLE_THRESHOLD) {
if ((long) max - (long) min >= SWITCH_TABLE_THRESHOLD) {
translateSwitchToBinarySearch(statement, condition, initialWrapper, defaultTarget, targets);
} else {
translateSwitchToWasmSwitch(statement, condition, initialWrapper, defaultTarget, targets, min, max);
@ -804,7 +804,7 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
final int label;
final WasmBlock target;
public TableEntry(int label, WasmBlock target) {
TableEntry(int label, WasmBlock target) {
this.label = label;
this.target = target;
}