subtract switch start value to compatible with br_table

This commit is contained in:
Volker Berlin 2018-05-08 18:10:52 +02:00
parent 0ece5f2dfe
commit b06b368574

View File

@ -753,7 +753,12 @@ public abstract class ModuleWriter implements Closeable {
byteCode.readInt();
}
} else {
int count = -byteCode.readInt() + byteCode.readInt() + 1;
int low = byteCode.readInt();
if( low != 0 ) { // the br_table starts ever with the value 0. That we need to subtract the start value if it different
writeConstInt( low );
writeNumericOperator( NumericOperator.sub, ValueType.i32 );
}
int count = byteCode.readInt() - low + 1;
for( int i = 0; i < count; i++ ) {
byteCode.readInt();
}