aboutsummaryrefslogtreecommitdiff
path: root/BinaryEncoding.md
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2016-03-02 10:00:46 -0800
committerBen Smith <binjimin@gmail.com>2016-03-02 10:00:46 -0800
commite8f8df239a748a5bb7f9dc50cd788fc52d1e98fe (patch)
treebdeed46a116c0def3f7b495583d0b25e748c23f0 /BinaryEncoding.md
parente7c0ac5aac60fb7745532074a8a38ac0bbec6bc4 (diff)
parent1209c31424fdd5713e1bf1b889c83e0a86a83c76 (diff)
downloadnanowasm-design-e8f8df239a748a5bb7f9dc50cd788fc52d1e98fe.tar.gz
Merge pull request #579 from WebAssembly/const-leb
Remove i8.const and make {i32,i64}.const varints.
Diffstat (limited to 'BinaryEncoding.md')
-rw-r--r--BinaryEncoding.md11
1 files changed, 8 insertions, 3 deletions
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 |