How to construct a https://docs.rs/wast/35.0.2/wast/struct.Float32.html?

Quoting wast::Instruction - Rust

    I32Const(i32),
    I64Const(i64),
    F32Const(Float32),
    F64Const(Float64),

Pushing a i32/i64 is straight forward. However, how do we push a f32/f64 ?

The docs leads to: wast::Float32 - Rust but there is no obvious way to construct Float32 / Float64. (Also, why does the source mention 'bits', I was under the impression that this was all pre defined under the ieee 743 floating point spec).

Field bits is public, so just Float32 { bits: float.to_bits() }, where to_bits is this inherent method, should work.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.