diff --git a/crates/core/src/untyped.rs b/crates/core/src/untyped.rs index 1baf7f5219..b8a8a4eaa1 100644 --- a/crates/core/src/untyped.rs +++ b/crates/core/src/untyped.rs @@ -923,142 +923,142 @@ impl UntypedVal { /// Execute `f32.abs` Wasm operation. pub fn f32_abs(self) -> Self { - self.execute_unary(>::abs) + self.execute_unary(::abs) } /// Execute `f32.neg` Wasm operation. pub fn f32_neg(self) -> Self { - self.execute_unary(::neg) + self.execute_unary(::neg) } /// Execute `f32.ceil` Wasm operation. pub fn f32_ceil(self) -> Self { - self.execute_unary(>::ceil) + self.execute_unary(::ceil) } /// Execute `f32.floor` Wasm operation. pub fn f32_floor(self) -> Self { - self.execute_unary(>::floor) + self.execute_unary(::floor) } /// Execute `f32.trunc` Wasm operation. pub fn f32_trunc(self) -> Self { - self.execute_unary(>::trunc) + self.execute_unary(::trunc) } /// Execute `f32.nearest` Wasm operation. pub fn f32_nearest(self) -> Self { - self.execute_unary(>::nearest) + self.execute_unary(::nearest) } /// Execute `f32.sqrt` Wasm operation. pub fn f32_sqrt(self) -> Self { - self.execute_unary(>::sqrt) - } - - /// Execute `f32.min` Wasm operation. - pub fn f32_min(self, other: Self) -> Self { - self.execute_binary(other, >::min) - } - - /// Execute `f32.max` Wasm operation. - pub fn f32_max(self, other: Self) -> Self { - self.execute_binary(other, >::max) - } - - /// Execute `f32.copysign` Wasm operation. - pub fn f32_copysign(self, other: Self) -> Self { - self.execute_binary(other, >::copysign) + self.execute_unary(::sqrt) } /// Execute `f64.abs` Wasm operation. pub fn f64_abs(self) -> Self { - self.execute_unary(>::abs) + self.execute_unary(::abs) } /// Execute `f64.neg` Wasm operation. pub fn f64_neg(self) -> Self { - self.execute_unary(::neg) + self.execute_unary(::neg) } /// Execute `f64.ceil` Wasm operation. pub fn f64_ceil(self) -> Self { - self.execute_unary(>::ceil) + self.execute_unary(::ceil) } /// Execute `f64.floor` Wasm operation. pub fn f64_floor(self) -> Self { - self.execute_unary(>::floor) + self.execute_unary(::floor) } /// Execute `f64.trunc` Wasm operation. pub fn f64_trunc(self) -> Self { - self.execute_unary(>::trunc) + self.execute_unary(::trunc) } /// Execute `f64.nearest` Wasm operation. pub fn f64_nearest(self) -> Self { - self.execute_unary(>::nearest) + self.execute_unary(::nearest) } /// Execute `f64.sqrt` Wasm operation. pub fn f64_sqrt(self) -> Self { - self.execute_unary(>::sqrt) + self.execute_unary(::sqrt) } /// Execute `f32.add` Wasm operation. pub fn f32_add(self, rhs: Self) -> Self { - self.execute_binary(rhs, >::add) + self.execute_binary(rhs, ::add) } /// Execute `f64.add` Wasm operation. pub fn f64_add(self, rhs: Self) -> Self { - self.execute_binary(rhs, >::add) + self.execute_binary(rhs, ::add) } /// Execute `f32.sub` Wasm operation. pub fn f32_sub(self, rhs: Self) -> Self { - self.execute_binary(rhs, >::sub) + self.execute_binary(rhs, ::sub) } /// Execute `f64.sub` Wasm operation. pub fn f64_sub(self, rhs: Self) -> Self { - self.execute_binary(rhs, >::sub) + self.execute_binary(rhs, ::sub) } /// Execute `f32.mul` Wasm operation. pub fn f32_mul(self, rhs: Self) -> Self { - self.execute_binary(rhs, >::mul) + self.execute_binary(rhs, ::mul) } /// Execute `f64.mul` Wasm operation. pub fn f64_mul(self, rhs: Self) -> Self { - self.execute_binary(rhs, >::mul) + self.execute_binary(rhs, ::mul) } /// Execute `f32.div` Wasm operation. pub fn f32_div(self, rhs: Self) -> Self { - self.execute_binary(rhs, >::div) + self.execute_binary(rhs, ::div) } /// Execute `f64.div` Wasm operation. pub fn f64_div(self, rhs: Self) -> Self { - self.execute_binary(rhs, >::div) + self.execute_binary(rhs, ::div) + } + + /// Execute `f32.min` Wasm operation. + pub fn f32_min(self, other: Self) -> Self { + self.execute_binary(other, ::min) } /// Execute `f64.min` Wasm operation. pub fn f64_min(self, other: Self) -> Self { - self.execute_binary(other, >::min) + self.execute_binary(other, ::min) + } + + /// Execute `f32.max` Wasm operation. + pub fn f32_max(self, other: Self) -> Self { + self.execute_binary(other, ::max) } /// Execute `f64.max` Wasm operation. pub fn f64_max(self, other: Self) -> Self { - self.execute_binary(other, >::max) + self.execute_binary(other, ::max) + } + + /// Execute `f32.copysign` Wasm operation. + pub fn f32_copysign(self, other: Self) -> Self { + self.execute_binary(other, ::copysign) } /// Execute `f64.copysign` Wasm operation. pub fn f64_copysign(self, other: Self) -> Self { - self.execute_binary(other, >::copysign) + self.execute_binary(other, ::copysign) } /// Execute `i32.wrap_i64` Wasm operation. @@ -1079,7 +1079,7 @@ impl UntypedVal { /// [WebAssembly specification]: /// https://webassembly.github.io/spec/core/exec/numerics.html#op-trunc-s pub fn i32_trunc_f32_s(self) -> Result { - self.try_execute_unary(>::try_truncate_into) + self.try_execute_unary(>::try_truncate_into) } /// Execute `i32.trunc_f32_u` Wasm operation. @@ -1095,7 +1095,7 @@ impl UntypedVal { /// [WebAssembly specification]: /// https://webassembly.github.io/spec/core/exec/numerics.html#op-trunc-s pub fn i32_trunc_f32_u(self) -> Result { - self.try_execute_unary(>::try_truncate_into) + self.try_execute_unary(>::try_truncate_into) } /// Execute `i32.trunc_f64_s` Wasm operation. @@ -1111,7 +1111,7 @@ impl UntypedVal { /// [WebAssembly specification]: /// https://webassembly.github.io/spec/core/exec/numerics.html#op-trunc-s pub fn i32_trunc_f64_s(self) -> Result { - self.try_execute_unary(>::try_truncate_into) + self.try_execute_unary(>::try_truncate_into) } /// Execute `i32.trunc_f64_u` Wasm operation. @@ -1127,7 +1127,7 @@ impl UntypedVal { /// [WebAssembly specification]: /// https://webassembly.github.io/spec/core/exec/numerics.html#op-trunc-s pub fn i32_trunc_f64_u(self) -> Result { - self.try_execute_unary(>::try_truncate_into) + self.try_execute_unary(>::try_truncate_into) } /// Execute `i64.extend_i32_s` Wasm operation. @@ -1148,7 +1148,7 @@ impl UntypedVal { /// [WebAssembly specification]: /// https://webassembly.github.io/spec/core/exec/numerics.html#op-trunc-s pub fn i64_trunc_f32_s(self) -> Result { - self.try_execute_unary(>::try_truncate_into) + self.try_execute_unary(>::try_truncate_into) } /// Execute `i64.trunc_f32_u` Wasm operation. @@ -1164,7 +1164,7 @@ impl UntypedVal { /// [WebAssembly specification]: /// https://webassembly.github.io/spec/core/exec/numerics.html#op-trunc-s pub fn i64_trunc_f32_u(self) -> Result { - self.try_execute_unary(>::try_truncate_into) + self.try_execute_unary(>::try_truncate_into) } /// Execute `i64.trunc_f64_s` Wasm operation. @@ -1180,7 +1180,7 @@ impl UntypedVal { /// [WebAssembly specification]: /// https://webassembly.github.io/spec/core/exec/numerics.html#op-trunc-s pub fn i64_trunc_f64_s(self) -> Result { - self.try_execute_unary(>::try_truncate_into) + self.try_execute_unary(>::try_truncate_into) } /// Execute `i64.trunc_f64_u` Wasm operation. @@ -1196,7 +1196,7 @@ impl UntypedVal { /// [WebAssembly specification]: /// https://webassembly.github.io/spec/core/exec/numerics.html#op-trunc-s pub fn i64_trunc_f64_u(self) -> Result { - self.try_execute_unary(>::try_truncate_into) + self.try_execute_unary(>::try_truncate_into) } /// Execute `f32.convert_i32_s` Wasm operation. @@ -1246,7 +1246,7 @@ impl UntypedVal { /// Execute `f64.promote_f32` Wasm operation. pub fn f64_promote_f32(self) -> Self { - self.execute_unary(>::extend_into) + self.execute_unary(>::extend_into) } /// Execute `i32.extend8_s` Wasm operation. @@ -1276,42 +1276,42 @@ impl UntypedVal { /// Execute `i32.trunc_sat_f32_s` Wasm operation. pub fn i32_trunc_sat_f32_s(self) -> Self { - self.execute_unary(>::truncate_saturate_into) + self.execute_unary(>::truncate_saturate_into) } /// Execute `i32.trunc_sat_f32_u` Wasm operation. pub fn i32_trunc_sat_f32_u(self) -> Self { - self.execute_unary(>::truncate_saturate_into) + self.execute_unary(>::truncate_saturate_into) } /// Execute `i32.trunc_sat_f64_s` Wasm operation. pub fn i32_trunc_sat_f64_s(self) -> Self { - self.execute_unary(>::truncate_saturate_into) + self.execute_unary(>::truncate_saturate_into) } /// Execute `i32.trunc_sat_f64_u` Wasm operation. pub fn i32_trunc_sat_f64_u(self) -> Self { - self.execute_unary(>::truncate_saturate_into) + self.execute_unary(>::truncate_saturate_into) } /// Execute `i64.trunc_sat_f32_s` Wasm operation. pub fn i64_trunc_sat_f32_s(self) -> Self { - self.execute_unary(>::truncate_saturate_into) + self.execute_unary(>::truncate_saturate_into) } /// Execute `i64.trunc_sat_f32_u` Wasm operation. pub fn i64_trunc_sat_f32_u(self) -> Self { - self.execute_unary(>::truncate_saturate_into) + self.execute_unary(>::truncate_saturate_into) } /// Execute `i64.trunc_sat_f64_s` Wasm operation. pub fn i64_trunc_sat_f64_s(self) -> Self { - self.execute_unary(>::truncate_saturate_into) + self.execute_unary(>::truncate_saturate_into) } /// Execute `i64.trunc_sat_f64_u` Wasm operation. pub fn i64_trunc_sat_f64_u(self) -> Self { - self.execute_unary(>::truncate_saturate_into) + self.execute_unary(>::truncate_saturate_into) } } diff --git a/crates/core/src/value.rs b/crates/core/src/value.rs index da233825c9..63c1246d65 100644 --- a/crates/core/src/value.rs +++ b/crates/core/src/value.rs @@ -197,7 +197,7 @@ impl_little_endian_convert_float!( ); /// Arithmetic operations. -pub trait ArithmeticOps: Copy { +pub trait ArithmeticOps: Copy { /// Add two values. fn add(self, other: T) -> T; /// Subtract two values. @@ -233,7 +233,7 @@ pub trait Integer: ArithmeticOps { } /// Float-point value. -pub trait Float: ArithmeticOps { +pub trait Float: ArithmeticOps { /// Get absolute value. fn abs(self) -> T; /// Returns the largest integer less than or equal to a number. @@ -624,6 +624,8 @@ macro_rules! impl_float { } impl_float!( type F32 as f32 ); impl_float!( type F64 as f64 ); +impl_float!( type f32 as f32 ); +impl_float!( type f64 as f64 ); /// Low-level Wasm float interface to support `no_std` environments. ///