From d20e7889d608522e6fd57ed9691f78c53b02e3e7 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Dec 2023 14:36:24 +0100 Subject: feat: improve func type resolution, int ops Signed-off-by: Henry --- crates/types/src/instructions.rs | 4 +++- crates/types/src/lib.rs | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'crates/types') diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs index 3f7b2ef..5ccebaf 100644 --- a/crates/types/src/instructions.rs +++ b/crates/types/src/instructions.rs @@ -65,7 +65,7 @@ pub enum Instruction { // Parametric Instructions // See Drop, - Select, + Select(Option), // Variable Instructions // See @@ -213,6 +213,8 @@ pub enum Instruction { I32TruncF32U, I32TruncF64S, I32TruncF64U, + I32Extend8S, + I32Extend16S, I64ExtendI32S, I64ExtendI32U, I64TruncF32S, diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index 85bfcd2..12cdbfb 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -103,6 +103,17 @@ impl WasmValue { ValType::ExternRef => unimplemented!("ExternRef is not yet supported"), } } + + pub fn eq_bits(&self, other: &Self) -> bool { + match (self, other) { + (Self::I32(a), Self::I32(b)) => a == b, + (Self::I64(a), Self::I64(b)) => a == b, + (Self::F32(a), Self::F32(b)) => a.to_bits() == b.to_bits(), + (Self::F64(a), Self::F64(b)) => a.to_bits() == b.to_bits(), + // (Self::V128(a), Self::V128(b)) => a == b, + _ => false, + } + } } impl From for WasmValue { -- cgit v1.3.1