aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/armv7/thumb.rs2
-rw-r--r--tests/armv7/thumb.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/armv7/thumb.rs b/src/armv7/thumb.rs
index baa2352..2e960b1 100644
--- a/src/armv7/thumb.rs
+++ b/src/armv7/thumb.rs
@@ -4174,7 +4174,7 @@ pub fn decode_into<T: Reader<<ARMv7 as Arch>::Address, <ARMv7 as Arch>::Word>>(d
// v4T
inst.opcode = Opcode::B;
let imm = instr2[0..11].load::<u32>();
- let imm = ((imm as i32) << 20) >> 20;
+ let imm = ((imm as i32) << 21) >> 21;
inst.operands = [
Operand::BranchThumbOffset(imm),
Operand::Nothing,
diff --git a/tests/armv7/thumb.rs b/tests/armv7/thumb.rs
index be5434f..dc912a6 100644
--- a/tests/armv7/thumb.rs
+++ b/tests/armv7/thumb.rs
@@ -490,6 +490,10 @@ fn test_decode_adr_cases() {
#[test]
fn test_decode_bcc_cases() {
test_display(
+ &[0xfe, 0xe7],
+ "b $-0x4"
+ );
+ test_display(
&[0x80, 0x47],
"blx r0"
);