Skip to content

Commit 36c0f1f

Browse files
committed
Add explanation of types and functions
1 parent 88a89f6 commit 36c0f1f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,25 @@ fetch('module.wasm').then(response =>
6161
console.log(results.instance.exports.test(4, 2));
6262
});
6363
```
64+
65+
### Types
66+
- `i32`: 32-bit integer
67+
- `i64`: 64-bit integer
68+
- `f32`: 32-bit floating point
69+
- `f64`: 64-bit floating point
70+
71+
### Functions
72+
All code in WebAssembly is grouped into functions
73+
74+
```cpp
75+
int add(int a, int b) {
76+
return a + b;
77+
}
78+
```
79+
80+
```WebAssembly
81+
(func $add (param $a i32) (param $b i32) (result i32)
82+
(i32.add
83+
(get_local $a)
84+
(get_local $b)))
85+
```

0 commit comments

Comments
 (0)