From 7775c57a81439a435eba31d762e5d3e0ba729c0a Mon Sep 17 00:00:00 2001 From: zach Date: Tue, 22 Oct 2024 09:33:04 -0700 Subject: [PATCH] fix: use `f32::to_bits` and `f64::to_bits` when constructing `Val` (#779) Fixes #739 --- runtime/src/sdk.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/sdk.rs b/runtime/src/sdk.rs index 6f85d24..b88ce8f 100644 --- a/runtime/src/sdk.rs +++ b/runtime/src/sdk.rs @@ -266,8 +266,8 @@ pub unsafe extern "C" fn extism_function_new( match tmp.t { ValType::I32 => *out = Val::I32(tmp.v.i32), ValType::I64 => *out = Val::I64(tmp.v.i64), - ValType::F32 => *out = Val::F32(tmp.v.f32 as u32), - ValType::F64 => *out = Val::F64(tmp.v.f64 as u64), + ValType::F32 => *out = Val::F32(tmp.v.f32.to_bits()), + ValType::F64 => *out = Val::F64(tmp.v.f64.to_bits()), _ => todo!(), } }