File tree Expand file tree Collapse file tree 1 file changed +71
-0
lines changed Expand file tree Collapse file tree 1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change @@ -239,3 +239,74 @@ for (int i = 0; i < 10; i++) {
239239 (get_local $a)
240240 (get_local $b)))
241241```
242+
243+ ### Conversion
244+
245+ ``` WebAssembly
246+ (func $i64_to_i32 (param i64) (result i32)
247+ (i32.wrap/i64
248+ (get_local 0)))
249+
250+ (func $f32_to_i32 (param f32) (result i32)
251+ (i32.trunc_s/f32
252+ (get_local 0)))
253+
254+ (func $f64_to_i32 (param f64) (result i32)
255+ (i32.trunc_s/f64
256+ (get_local 0)))
257+
258+ (func $i32_to_i64 (param i32) (result i64)
259+ (i64.extend_s/i32
260+ (get_local 0)))
261+
262+ (func $f32_to_i64 (param f32) (result i64)
263+ (i64.trunc_s/f32
264+ (get_local 0)))
265+
266+ (func $f64_to_i64 (param f64) (result i64)
267+ (i64.trunc_s/f64
268+ (get_local 0)))
269+
270+ (func $i32_to_f32 (param i32) (result f32)
271+ (f32.convert_s/i32
272+ (get_local 0)))
273+
274+ (func $i64_to_f32 (param i64) (result f32)
275+ (f32.convert_s/i64
276+ (get_local 0)))
277+
278+ (func $f64_to_f32 (param f64) (result f32)
279+ (f32.demote/f64
280+ (get_local 0)))
281+
282+ (func $i32_to_f64 (param i32) (result f64)
283+ (f64.convert_s/i32
284+ (get_local 0)))
285+
286+ (func $i64_to_f64 (param i64) (result f64)
287+ (f64.convert_s/i64
288+ (get_local 0)))
289+
290+ (func $f32_to_f64 (param f32) (result f64)
291+ (f64.promote/f32
292+ (get_local 0)))
293+
294+ (func $i32_to_bool (param i32) (result i32)
295+ (i32.ne
296+ (get_local 0)
297+ (i32.const 0)))
298+
299+ (func $i32_to_i8 (param i32) (result i32)
300+ (i32.shr_s
301+ (i32.shl
302+ (get_local 0)
303+ (i32.const 24))
304+ (i32.const 24)))
305+
306+ (func $i32_to_i16 (param i32) (result i32)
307+ (i32.shr_s
308+ (i32.shl
309+ (get_local 0)
310+ (i32.const 16))
311+ (i32.const 16)))
312+ ```
You can’t perform that action at this time.
0 commit comments