From 1209c31424fdd5713e1bf1b889c83e0a86a83c76 Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Tue, 1 Mar 2016 15:05:53 -0800 Subject: Remove i8.const and make {i32,i64}.const varints. --- BinaryEncoding.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 926f744..a91dd58 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -38,9 +38,15 @@ A two-byte little endian unsigned integer. ### uint32 A four-byte little endian unsigned integer. +### varint32 +A [Signed LEB128](https://en.wikipedia.org/wiki/LEB128#Signed_LEB128) variable-length integer, limited to int32 values. + ### varuint32 A [LEB128](https://en.wikipedia.org/wiki/LEB128) variable-length integer, limited to uint32 values. `varuint32` values may contain leading zeros. +### varint64 +A [Signed LEB128](https://en.wikipedia.org/wiki/LEB128#Signed_LEB128) variable-length integer, limited to int64 values. + ### value_type A single-byte unsigned integer indicating a [value type](AstSemantics.md#types). These types are encoded as: * `1` indicating type `i32` @@ -317,9 +323,8 @@ The table switch operator is then immediately followed by `case_count` case expr ## Basic operators ([described here](AstSemantics.md#constants)) | Name | Opcode | Immediate | Description | | ---- | ---- | ---- | ---- | -| `i8.const` | `0x09` | value = `int8` | a constant value, signed extended to type `i32` | -| `i32.const` | `0x0a` | value = `uint32` | a constant value interpreted as `i32` | -| `i64.const` | `0x0b` | value = `uint64` | a constant value interpreted as `i64` | +| `i32.const` | `0x0a` | value = `varint32` | a constant value interpreted as `i32` | +| `i64.const` | `0x0b` | value = `varint64` | a constant value interpreted as `i64` | | `f64.const` | `0x0c` | value = `uint64` | a constant value interpreted as `f64` | | `f32.const` | `0x0d` | value = `uint32` | a constant value interpreted as `f32` | | `get_local` | `0x0e` | local_index = `varuint32` | read a local variable or parameter | -- cgit v1.2.3