mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
WASM: fix translation of lookupswitch when min and max values differ by
more than 2^31
This commit is contained in:
parent
6630175598
commit
d09affce85
|
@ -745,7 +745,7 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
|
||||||
WasmBlock defaultTarget = wrapper;
|
WasmBlock defaultTarget = wrapper;
|
||||||
wrapper = defaultBlock;
|
wrapper = defaultBlock;
|
||||||
|
|
||||||
if (max - min >= SWITCH_TABLE_THRESHOLD) {
|
if ((long) max - (long) min >= SWITCH_TABLE_THRESHOLD) {
|
||||||
translateSwitchToBinarySearch(statement, condition, initialWrapper, defaultTarget, targets);
|
translateSwitchToBinarySearch(statement, condition, initialWrapper, defaultTarget, targets);
|
||||||
} else {
|
} else {
|
||||||
translateSwitchToWasmSwitch(statement, condition, initialWrapper, defaultTarget, targets, min, max);
|
translateSwitchToWasmSwitch(statement, condition, initialWrapper, defaultTarget, targets, min, max);
|
||||||
|
@ -804,7 +804,7 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
|
||||||
final int label;
|
final int label;
|
||||||
final WasmBlock target;
|
final WasmBlock target;
|
||||||
|
|
||||||
public TableEntry(int label, WasmBlock target) {
|
TableEntry(int label, WasmBlock target) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user