refactor binary encoding to its own package (#1187)

move binary encoder to its own package

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
This commit is contained in:
Edoardo Vacchi
2023-03-03 00:21:22 +01:00
committed by GitHub
parent e2660b3f17
commit 117474c477
56 changed files with 1042 additions and 608 deletions

View File

@@ -37,10 +37,3 @@ func decodeTable(r *bytes.Reader, enabledFeatures api.CoreFeatures) (*wasm.Table
}
return &wasm.Table{Min: min, Max: max, Type: tableType}, nil
}
// encodeTable returns the wasm.Table encoded in WebAssembly 1.0 (20191205) Binary Format.
//
// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-table
func encodeTable(i *wasm.Table) []byte {
return append([]byte{i.Type}, encodeLimitsType(i.Min, i.Max)...)
}