mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +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 114: // frem
|
||||||
case 115: // drem
|
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 );
|
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
|
case 136: // l2i
|
||||||
writeCast( ValueTypeConvertion.l2i );
|
writeCast( ValueTypeConvertion.l2i );
|
||||||
break;
|
break;
|
||||||
|
@ -99,6 +99,7 @@ public class MathOperations {
|
|||||||
|
|
||||||
@Export
|
@Export
|
||||||
static int addInt( int a, int b ) {
|
static int addInt( int a, int b ) {
|
||||||
|
b++;
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +127,9 @@ public class MathOperations {
|
|||||||
|
|
||||||
@Export
|
@Export
|
||||||
static int subLong() {
|
static int subLong() {
|
||||||
long a = 1L;
|
long a = -1L;
|
||||||
long b = 3L;
|
long b = 3L;
|
||||||
|
a--;
|
||||||
return (int)(a - b);
|
return (int)(a - b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user