diff options
| author | Henry <mail@henrygressmann.de> | 2023-12-25 14:36:24 +0100 |
|---|---|---|
| committer | Henry <mail@henrygressmann.de> | 2023-12-25 14:37:18 +0100 |
| commit | d20e7889d608522e6fd57ed9691f78c53b02e3e7 (patch) | |
| tree | 863c350ef7d0f8d172bb800e717c929c6a338a27 /crates/types | |
| parent | 4ee0bacbf79c41661b24e6cb9e4420cca33dc039 (diff) | |
feat: improve func type resolution, int ops
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/types')
| -rw-r--r-- | crates/types/src/instructions.rs | 4 | ||||
| -rw-r--r-- | crates/types/src/lib.rs | 11 |
2 files changed, 14 insertions, 1 deletions
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 <https://webassembly.github.io/spec/core/binary/instructions.html#parametric-instructions> Drop, - Select, + Select(Option<ValType>), // Variable Instructions // See <https://webassembly.github.io/spec/core/binary/instructions.html#variable-instructions> @@ -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<i32> for WasmValue { |
