Skip to content

Commit

Permalink
bt/bts: bit op is mod 32
Browse files Browse the repository at this point in the history
  • Loading branch information
evmar committed Sep 15, 2024
1 parent 2576aeb commit 6427aed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x86/src/ops/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ pub fn xlat_m8(cpu: &mut CPU, mem: Mem, _instr: &Instruction) {
}

pub fn bts_rm32_r32(cpu: &mut CPU, mem: Mem, instr: &Instruction) {
let y = op1_rm32(cpu, mem, instr);
let y = op1_rm32(cpu, mem, instr) % 32;
let x = rm32(cpu, mem, instr);
let mask = 1u32 << y;
cpu.flags.set(Flags::CF, x.get() & mask != 0);
Expand Down
2 changes: 1 addition & 1 deletion x86/src/ops/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn test_rm8_imm8(cpu: &mut CPU, mem: Mem, instr: &Instruction) {

pub fn bt_rm32_r32(cpu: &mut CPU, mem: Mem, instr: &Instruction) {
let x = rm32(cpu, mem, instr).get();
let y = op1_rm32(cpu, mem, instr);
let y = op1_rm32(cpu, mem, instr) % 32;
cpu.flags.set(Flags::CF, ((x >> y) & 1) != 0);
}

Expand Down

0 comments on commit 6427aed

Please sign in to comment.