mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 02:44:47 +01:00
add support for inc/dec
This commit is contained in:
parent
65c83c8f4b
commit
28d4fb9b1c
@ -395,6 +395,13 @@ public abstract class ModuleWriter implements Closeable {
|
||||
case 114: // frem
|
||||
case 115: // drem
|
||||
throw new WasmException( "Modulo/Remainder for floating numbers is not supported in WASM. Use int or long data types." + op, sourceFile, lineNumber );
|
||||
case 132: // iinc
|
||||
int idx = byteCode.readUnsignedByte();
|
||||
writeLoadStore( true, ValueType.i32, idx );
|
||||
writeConstInt( byteCode.readUnsignedByte() );
|
||||
writeNumericOperator( NumericOperator.add, ValueType.i32);
|
||||
writeLoadStore( false, ValueType.i32, idx );
|
||||
break;
|
||||
case 136: // l2i
|
||||
writeCast( ValueTypeConvertion.l2i );
|
||||
break;
|
||||
|
@ -99,6 +99,7 @@ public class MathOperations {
|
||||
|
||||
@Export
|
||||
static int addInt( int a, int b ) {
|
||||
b++;
|
||||
return a + b;
|
||||
}
|
||||
|
||||
@ -126,8 +127,9 @@ public class MathOperations {
|
||||
|
||||
@Export
|
||||
static int subLong() {
|
||||
long a = 1L;
|
||||
long a = -1L;
|
||||
long b = 3L;
|
||||
a--;
|
||||
return (int)(a - b);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user