aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-03-30 15:27:25 -0700
committeriximeow <me@iximeow.net>2020-01-12 16:10:13 -0800
commit9ca5adc847098d6f74f49707b94ed0df23626c18 (patch)
treedfc71dc49c4b93e95585b05680fd5832f3c290e1 /src/lib.rs
parent53d8bbd02980da9558fd972065491af836a136ee (diff)
fix incorrect sign tests and decode oddities
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs13
1 files changed, 11 insertions, 2 deletions
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);
+ }
}
}
}