write ValueType codes in signed LEB format

This commit is contained in:
Volker Berlin 2018-12-03 20:52:01 +01:00
parent 74dcb4dc09
commit c2c872024b
2 changed files with 10 additions and 10 deletions

View File

@ -72,7 +72,7 @@ class WasmOutputStream extends FilterOutputStream {
* if an I/O error occurs. * if an I/O error occurs.
*/ */
public void writeValueType( ValueType type ) throws IOException { public void writeValueType( ValueType type ) throws IOException {
write( type.getCode() ); writeVarint( type.getCode() );
} }
/** /**

View File

@ -21,15 +21,15 @@ import de.inetsoftware.jwebassembly.WasmException;
* @author Volker Berlin * @author Volker Berlin
*/ */
public enum ValueType { public enum ValueType {
i32(0x7f), i32(-0x01),
i64(0x7e), i64(-0x02),
f32(0x7d), f32(-0x03),
f64(0x7c), f64(-0x04),
anyfunc(0x70), anyfunc(-0x10),
anyref(0x6f), anyref(-0x11),
except_ref(0x68), except_ref(-0x12),
func(0x60), func(-0x20),
empty(0x40), // empty block_type empty(-0x40), // empty block_type
; ;
private final int code; private final int code;