From 9835359ed86e3cb570418bc15234fbb7aca4cee8 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 13 Jan 2020 19:58:05 -0800 Subject: add Default impl for Instruction to track yaxpeax-arch --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index a2c27d0..9409ca9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2485,6 +2485,12 @@ impl Opcode { } } +impl Default for Instruction { + fn default() -> Self { + Instruction::invalid() + } +} + impl Instruction { pub fn operand(&self, i: u8) -> Operand { assert!(i < 4); @@ -2528,12 +2534,14 @@ impl Instruction { operands: [OperandSpec::Nothing; 4], } } + pub fn is_invalid(&self) -> bool { match self.opcode { Opcode::Invalid => true, _ => false } } + pub fn segment_override_for_op(&self, op: u8) -> Option { match self.opcode { Opcode::STOS => { -- cgit v1.1