Skip to content

Commit

Permalink
fix From<float> impls for UntypedValue (wasmi-labs#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop authored Mar 29, 2022
1 parent 805ff4e commit 6133346
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions core/src/untyped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ macro_rules! impl_from_prim {
$(
impl From<$prim> for UntypedValue {
fn from(value: $prim) -> Self {
Self { bits: value as u64 }
Self { bits: value as _ }
}
}
)*
Expand All @@ -105,24 +105,22 @@ impl_from_prim!(
bool,
i8, i16, i32, i64,
u8, u16, u32, u64,
f32, f64,
);

impl From<F32> for UntypedValue {
fn from(value: F32) -> Self {
Self {
bits: value.to_bits() as u64,
}
}
}

impl From<F64> for UntypedValue {
fn from(value: F64) -> Self {
Self {
bits: value.to_bits() as u64,
}
}
macro_rules! impl_from_float {
( $( $float:ty ),* $(,)? ) => {
$(
impl From<$float> for UntypedValue {
fn from(value: $float) -> Self {
Self {
bits: value.to_bits() as _,
}
}
}
)*
};
}
impl_from_float!(f32, f64, F32, F64);

macro_rules! op {
( $operator:tt ) => {{
Expand Down

0 comments on commit 6133346

Please sign in to comment.