From 37e8c767c1d84c47adaa763433c87766cece4050 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 21 Oct 2019 00:52:48 -0700 Subject: more squeezing!! --- src/lib.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 51eb232..c59711a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2536,13 +2536,15 @@ pub fn read_operands>(mut bytes_iter: T, instruction: &mut mem_oper = read_E(&mut bytes_iter, instruction, modrm, opwidth)?; } - if operand_code == OperandCode::Gv_Ev || operand_code == OperandCode::Gb_Eb { - instruction.operands[1] = mem_oper; - instruction.operands[0] = OperandSpec::RegRRR; - instruction.operand_count = 2; - } else if operand_code == OperandCode::Ev_Gv || operand_code == OperandCode::Eb_Gb { - instruction.operands[0] = mem_oper; - instruction.operands[1] = OperandSpec::RegRRR; + let numeric_code = operand_code as u8; + if numeric_code >= 0x80 && numeric_code < 0x84 { + let (mmm, rrr) = if numeric_code & 0x02 == 2 { + (1, 0) + } else { + (0, 1) + }; + instruction.operands[mmm] = mem_oper; + instruction.operands[rrr] = OperandSpec::RegRRR; instruction.operand_count = 2; } else if operand_code == OperandCode::Jbs { // TODO: arch width (8 in 64, 4 in 32, 2 in 16) -- cgit v1.1