diff options
author | iximeow <me@iximeow.net> | 2019-01-05 02:05:14 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-01-12 16:10:13 -0800 |
commit | b14958d55dd098d43719ef0284fe3de2d8f7c020 (patch) | |
tree | 4641a1721dd95e76951d53cd2d63655ec09e9cd7 /src/lib.rs | |
parent | 1186a66e8cc48f4c0c424fdfb63aa4f752db7166 (diff) |
do not show *1 for SIB with scale == 1
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -73,10 +73,18 @@ impl fmt::Display for Operand { write!(f, "[{} + {} + 0x{:x}]", base, index, disp) }, &Operand::RegIndexBaseScale(ref base, ref index, scale) => { - write!(f, "[{} + {} * {}]", base, index, scale) + if scale == 1 { + write!(f, "[{} + {}]", base, index) + } else { + write!(f, "[{} + {} * {}]", base, index, scale) + } } &Operand::RegIndexBaseScaleDisp(ref base, ref index, scale, disp) => { - write!(f, "[{} + {} * {} + 0x{:x}]", base, index, scale, disp) + if scale == 1 { + write!(f, "[{} + {} + {:#x}]", base, index, disp) + } else { + write!(f, "[{} + {} * {} + {:#x}]", base, index, scale, disp) + } }, &Operand::Nothing => { Ok(()) }, &Operand::Many(_) => { panic!("many not covered"); } @@ -752,7 +760,7 @@ fn read_opcode(bytes_iter: &mut Iterator<Item=&u8>, instruction: &mut Instructio instruction.opcode = Opcode::Invalid; return Ok(OperandCode::Nothing); }, - _ => { unsafe { unreachable_unchecked(); } }// panic!("unreachable?") + _ => { unsafe { unreachable_unchecked(); } } } continue; } |