Skip to content

Commit

Permalink
Sign ext to u64
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsck committed Oct 5, 2021
1 parent 8a46c32 commit 77d90e7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/rust/iced-x86/src/decoder/handlers/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1607,24 +1607,24 @@ impl OpCodeHandler_Jb {
let this = unsafe { &*(self_ptr as *const Self) };
debug_assert_eq!(decoder.state.encoding(), EncodingKind::Legacy as u32);
decoder.state.flags |= StateFlags::BRANCH_IMM8;
let b = decoder.read_u8();
let b = decoder.read_u8() as i8 as u64;
if decoder.is64b_mode {
if (((decoder.options ^ DecoderOptions::AMD) & DecoderOptions::AMD) | (decoder.state.operand_size as u32 - OpSize::Size16 as u32)) != 0 {
instruction.set_near_branch64((b as i8 as u64).wrapping_add(decoder.current_ip64()));
instruction.set_near_branch64(b.wrapping_add(decoder.current_ip64()));
instruction.set_code(this.code64);
instruction.set_op0_kind(OpKind::NearBranch64);
} else {
instruction_internal::internal_set_near_branch16(instruction, (b as i8 as u32).wrapping_add(decoder.current_ip32()) as u16 as u32);
instruction_internal::internal_set_near_branch16(instruction, (b as u32).wrapping_add(decoder.current_ip32()) as u16 as u32);
instruction.set_code(this.code16);
instruction.set_op0_kind(OpKind::NearBranch16);
}
} else {
if decoder.state.operand_size != OpSize::Size16 {
instruction.set_near_branch32((b as i8 as u32).wrapping_add(decoder.current_ip32()));
instruction.set_near_branch32((b as u32).wrapping_add(decoder.current_ip32()));
instruction.set_code(this.code32);
instruction.set_op0_kind(OpKind::NearBranch32);
} else {
instruction_internal::internal_set_near_branch16(instruction, (b as i8 as u32).wrapping_add(decoder.current_ip32()) as u16 as u32);
instruction_internal::internal_set_near_branch16(instruction, (b as u32).wrapping_add(decoder.current_ip32()) as u16 as u32);
instruction.set_code(this.code16);
instruction.set_op0_kind(OpKind::NearBranch16);
}
Expand Down

0 comments on commit 77d90e7

Please sign in to comment.