Skip to content

std/convert

std/wasm/convert — conversion + reinterpret + sign-extension instruction encoders for the WebAssembly Core 1.0 binary format. Spec: https://webassembly.github.io/spec/core/binary/instructions.html#numeric-instructions (the “Conversions” subsection plus the sign-extension extension). Sixth slice of Phase 1 of docs/TOOLCHAIN-SELF-HOSTING.md. Conversions are the last big single-byte / no-immediate family: - Integer width: i32.wrap_i64, i64.extend_i32_{s,u} - Float-to-int: i32 / i64 . trunc_f{32,64}{s,u} - Int-to-float: f32 / f64 . convert_i{32,64}{s,u} - Float width: f32.demote_f64, f64.promote_f32 - Reinterpret (bit-pattern coercion, no value change): i32.reinterpret_f32, i64.reinterpret_f64, f32.reinterpret_i32, f64.reinterpret_i64 - Sign-extension (added after wasm 1.0 but always assumed present today): i32.extend{8,16}_s, i64.extend{8,16,32}_s Same one-line shape as numeric.fern. ~28 functions. Saturating-truncate (multi-byte 0xFC-prefix) ops aren’t included — the production wasm backend uses the trapping variants.

pub function inst_i32_wrap_i64(buf: u8[]): u8[]
pub function inst_i64_extend_i32_s(buf: u8[]): u8[]
pub function inst_i64_extend_i32_u(buf: u8[]): u8[]
pub function inst_i32_trunc_f32_s(buf: u8[]): u8[]
pub function inst_i32_trunc_f32_u(buf: u8[]): u8[]
pub function inst_i32_trunc_f64_s(buf: u8[]): u8[]
pub function inst_i32_trunc_f64_u(buf: u8[]): u8[]
pub function inst_i64_trunc_f32_s(buf: u8[]): u8[]
pub function inst_i64_trunc_f32_u(buf: u8[]): u8[]
pub function inst_i64_trunc_f64_s(buf: u8[]): u8[]
pub function inst_i64_trunc_f64_u(buf: u8[]): u8[]
pub function inst_f32_convert_i32_s(buf: u8[]): u8[]
pub function inst_f32_convert_i32_u(buf: u8[]): u8[]
pub function inst_f32_convert_i64_s(buf: u8[]): u8[]
pub function inst_f32_convert_i64_u(buf: u8[]): u8[]
pub function inst_f64_convert_i32_s(buf: u8[]): u8[]
pub function inst_f64_convert_i32_u(buf: u8[]): u8[]
pub function inst_f64_convert_i64_s(buf: u8[]): u8[]
pub function inst_f64_convert_i64_u(buf: u8[]): u8[]
pub function inst_f32_demote_f64(buf: u8[]): u8[]
pub function inst_f64_promote_f32(buf: u8[]): u8[]
pub function inst_i32_reinterpret_f32(buf: u8[]): u8[]
pub function inst_i64_reinterpret_f64(buf: u8[]): u8[]
pub function inst_f32_reinterpret_i32(buf: u8[]): u8[]
pub function inst_f64_reinterpret_i64(buf: u8[]): u8[]
pub function inst_i32_extend8_s(buf: u8[]): u8[]
pub function inst_i32_extend16_s(buf: u8[]): u8[]
pub function inst_i64_extend8_s(buf: u8[]): u8[]
pub function inst_i64_extend16_s(buf: u8[]): u8[]
pub function inst_i64_extend32_s(buf: u8[]): u8[]