aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/display.rs2
-rw-r--r--src/lib.rs13
2 files changed, 12 insertions, 3 deletions
diff --git a/src/display.rs b/src/display.rs
index daa2c34..6846174 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -162,7 +162,7 @@ impl <T: std::fmt::Write> Colorize<T> for Operand {
colors.register(base),
colors.register(index),
colors.number(scale),
- colors.number(format!("{:#x}", scale))
+ colors.number(format!("{:#x}", disp))
)
},
&Operand::Nothing => { Ok(()) },
diff --git a/src/lib.rs b/src/lib.rs
index 4665f28..f2e19c7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1342,9 +1342,18 @@ fn read_E<T: Iterator<Item=u8>>(bytes_iter: &mut T, prefixes: &Prefixes, m: u8,
} else {
let index_reg = RegSpec::gp_from_parts(index, prefixes.rex().x(), addr_width, prefixes.rex().present());
if disp == 0 {
- *result = Operand::RegIndexBaseScale(base_reg, index_reg, 1u8 << ss);
+ if ss == 0 {
+ *result = Operand::RegIndexBase(base_reg, index_reg)
+ } else {
+ *result = Operand::RegIndexBaseScale(base_reg, index_reg, 1u8 << ss);
+ }
} else {
- *result = Operand::RegIndexBaseScaleDisp(base_reg, index_reg, 1u8 << ss, disp as i32);
+ if ss == 0 {
+
+ *result = Operand::RegIndexBaseDisp(base_reg, index_reg, disp as i32);
+ } else {
+ *result = Operand::RegIndexBaseScaleDisp(base_reg, index_reg, 1u8 << ss, disp as i32);
+ }
}
}
}