summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-10-12 00:53:23 -0700
committeriximeow <me@iximeow.net>2020-10-12 00:53:23 -0700
commit30917045cff1bed6273cb40ad2d38271cbf64364 (patch)
tree91335f52601db75197b908d0fb8ddd9ede496a87 /src
parentc903c7ece85d22f3ee310ebaaa73241402e0be70 (diff)
fix negative ip-relative operands showing as `$+-const`
they are now `$-const`
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs56
1 files changed, 42 insertions, 14 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d0c7768..16a9af8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1091,8 +1091,12 @@ impl fmt::Display for Instruction {
return write!(f, "br{}{} {}{}",
[".few", ".many"][self.operands[1].as_unsigned_imm() as usize],
["", ".clr"][self.operands[3].as_unsigned_imm() as usize],
- if let Operand::ImmI64(_) = self.operands[0] {
- "$+"
+ if let Operand::ImmI64(imm) = self.operands[0] {
+ if imm >= 0 {
+ "$+"
+ } else {
+ "$"
+ }
} else {
""
},
@@ -1105,8 +1109,12 @@ impl fmt::Display for Instruction {
[".sptk", ".spnt", ".dptk", ".dpnt"][self.operands[2].as_unsigned_imm() as usize],
[".few", ".many"][self.operands[1].as_unsigned_imm() as usize],
["", ".clr"][self.operands[3].as_unsigned_imm() as usize],
- if let Operand::ImmI64(_) = self.operands[0] {
- "$+"
+ if let Operand::ImmI64(imm) = self.operands[0] {
+ if imm >= 0 {
+ "$+"
+ } else {
+ "$"
+ }
} else {
""
},
@@ -1119,8 +1127,12 @@ impl fmt::Display for Instruction {
[".few", ".many"][self.operands[2].as_unsigned_imm() as usize],
["", ".clr"][self.operands[4].as_unsigned_imm() as usize],
self.operands[0],
- if let Operand::ImmI64(_) = self.operands[1] {
- "$+"
+ if let Operand::ImmI64(imm) = self.operands[1] {
+ if imm >= 0 {
+ "$+"
+ } else {
+ "$"
+ }
} else {
""
},
@@ -1131,8 +1143,12 @@ impl fmt::Display for Instruction {
[".sptk", ".spnt", ".dptk", ".dpnt"][self.operands[2].as_unsigned_imm() as usize],
[".few", ".many"][self.operands[1].as_unsigned_imm() as usize],
["", ".clr"][self.operands[3].as_unsigned_imm() as usize],
- if let Operand::ImmI64(_) = self.operands[0] {
- "$+"
+ if let Operand::ImmI64(imm) = self.operands[0] {
+ if imm >= 0 {
+ "$+"
+ } else {
+ "$"
+ }
} else {
""
},
@@ -1143,8 +1159,12 @@ impl fmt::Display for Instruction {
[".sptk", ".spnt", ".dptk", ".dpnt"][self.operands[2].as_unsigned_imm() as usize],
[".few", ".many"][self.operands[1].as_unsigned_imm() as usize],
["", ".clr"][self.operands[3].as_unsigned_imm() as usize],
- if let Operand::ImmI64(_) = self.operands[0] {
- "$+"
+ if let Operand::ImmI64(imm) = self.operands[0] {
+ if imm >= 0 {
+ "$+"
+ } else {
+ "$"
+ }
} else {
""
},
@@ -1155,8 +1175,12 @@ impl fmt::Display for Instruction {
[".sptk", ".spnt", ".dptk", ".dpnt"][self.operands[2].as_unsigned_imm() as usize],
[".few", ".many"][self.operands[1].as_unsigned_imm() as usize],
["", ".clr"][self.operands[3].as_unsigned_imm() as usize],
- if let Operand::ImmI64(_) = self.operands[0] {
- "$+"
+ if let Operand::ImmI64(imm) = self.operands[0] {
+ if imm >= 0 {
+ "$+"
+ } else {
+ "$"
+ }
} else {
""
},
@@ -1167,8 +1191,12 @@ impl fmt::Display for Instruction {
[".sptk", ".spnt", ".dptk", ".dpnt"][self.operands[2].as_unsigned_imm() as usize],
[".few", ".many"][self.operands[1].as_unsigned_imm() as usize],
["", ".clr"][self.operands[3].as_unsigned_imm() as usize],
- if let Operand::ImmI64(_) = self.operands[0] {
- "$+"
+ if let Operand::ImmI64(imm) = self.operands[0] {
+ if imm >= 0 {
+ "$+"
+ } else {
+ "$"
+ }
} else {
""
},