重新解释

reinterpret 指令用于将数字的位重新解释为不同的类型。

试一试

语法

wasm
;; the value `10000000_00000000_00000000_00000000` in binary
;; maps to `-0` as a floating point and to `-2147483648` as an integer

;; push an f32 onto the stack
f32.const -0

;; reinterpret the bytes of the f32 as i32
i32.reinterpret_f32

;; the top item on the stack will now be the value -2147483648 of type i32
指令 二进制操作码
i32.reinterpret_f32 0xbc
i64.reinterpret_f64 0xbd
f32.reinterpret_i32 0xbe
f64.reinterpret_i64 0xbf