diff options
Diffstat (limited to 'src/display.rs')
-rw-r--r-- | src/display.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/display.rs b/src/display.rs index 036fb28..994880a 100644 --- a/src/display.rs +++ b/src/display.rs @@ -16,7 +16,7 @@ impl fmt::Display for Instruction { (Some(Operand::Reg(a)), Some(Operand::Reg(b)), Some(Operand::Imm(offs))) => { if a == b { if offs < 0 { - return write!(f, "b $-{:#x}", -offs); + return write!(f, "b $-{:#x}", offs.wrapping_neg()); } else { return write!(f, "b $+{:#x}", offs); } @@ -44,7 +44,7 @@ impl fmt::Display for Instruction { } } else if let Operand::Imm(imm) = op { if *imm < 0 { - return write!(f, "-{:#x}", -imm); + return write!(f, "-{:#x}", imm.wrapping_neg()); } else { return write!(f, "{:#x}", imm); } @@ -110,7 +110,7 @@ impl fmt::Display for Operand { write!(f, "({})", name) } else { if *offs < 0 { - write!(f, "-{:#x}({})", -offs, name) + write!(f, "-{:#x}({})", offs.wrapping_neg(), name) } else { write!(f, "{:#x}({})", offs, name) } |