-
Notifications
You must be signed in to change notification settings - Fork 911
Closed
Labels
π enhancementNew feature!New feature!
Description
When using f32.powf(f32) from a wasm module written in Rust, an unresolved dependency is created on ldexpf.
Maybe should predefine a few functions like this? Here's a working, although not very well tested, implementation:
fn wasm_ldexpf(
_ctx: &mut wasmer_runtime::Ctx,
arg: f32,
exp: i32,
) -> f32 {
// Construct a float directly with the desired exponent and multiply with it.
let multiplier : f32 = unsafe { std::mem::transmute((exp + 127) << 23) };
arg * multiplier
}
fn libc_imports() -> wasmer_runtime::ImportObject {
wasmer_runtime::imports! {
"env" => {
"ldexpf" => wasmer_runtime::func!(wasm_ldexpf),
},
}
}
Or alternatively, maybe the LLVM wasm compiler should be fixed to add intrinsics for these...
Metadata
Metadata
Assignees
Labels
π enhancementNew feature!New feature!