diff options
Diffstat (limited to 'crates/types/src')
| -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 { |
