Skip to content

Commit 9720790

Browse files
committed
shrd iteration control
1 parent a2d16f7 commit 9720790

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/emu.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,12 +1647,22 @@ impl Emu {
16471647
return storage0;
16481648
}
16491649

1650-
for i in 0..=(size as u64 - 1 - counter) {
1650+
let mut to = size as u64 - 1 - counter;
1651+
if to>64 {
1652+
// println!("to: {}", to);
1653+
to = 64;
1654+
}
1655+
1656+
for i in 0..=to {
16511657
let bit = get_bit!(storage0, i as u32 + counter as u32);
16521658
set_bit!(storage0, i as u32, bit);
16531659
}
16541660

1655-
for i in (size as u64 - counter)..size as u64 {
1661+
let from = size as u64 - counter;
1662+
1663+
//println!("from: {}", from);
1664+
1665+
for i in from..size as u64 {
16561666
let bit = get_bit!(value1, i as u32 + counter as u32 - size as u32);
16571667
set_bit!(storage0, i as u32, bit);
16581668
}
@@ -4648,6 +4658,24 @@ impl Emu {
46484658
}
46494659
}
46504660

4661+
// https://hjlebbink.github.io/x86doc/html/CMOVcc.html
4662+
4663+
Mnemonic::Cmovnp => {
4664+
self.show_instruction(&self.colors.orange, &ins);
4665+
4666+
if !self.flags.f_pf {
4667+
let value1 = match self.get_operand_value(&ins, 1, true) {
4668+
Some(v) => v,
4669+
None => break,
4670+
};
4671+
4672+
if !self.set_operand_value(&ins, 0, value1) {
4673+
break;
4674+
}
4675+
}
4676+
4677+
}
4678+
46514679

46524680
Mnemonic::Seta => {
46534681
self.show_instruction(&self.colors.orange, &ins);

0 commit comments

Comments
 (0)