diff options
author | iximeow <me@iximeow.net> | 2019-03-31 04:09:06 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-01-12 16:26:39 -0800 |
commit | 59f167042adc748ed156bdd05bc0ecc64524501d (patch) | |
tree | 3aef19b2360eddbc0dfe4bd8301e804a9c385224 | |
parent | 0b7536284cbae6e085eeeda602512449a42ca22a (diff) |
fix sign display bug
-rw-r--r-- | src/display.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/display.rs b/src/display.rs index 7dcdfb5..5ba9cd1 100644 --- a/src/display.rs +++ b/src/display.rs @@ -78,7 +78,7 @@ pub fn signed_i8_hex(imm: i8) -> String { } else { (false, imm) }; - format!("{}{:#x}", sign, imm) + format!("{}{:#x}", if sign { "-" } else { "" } , imm) } pub fn signed_i16_hex(imm: i16) -> String { @@ -89,7 +89,7 @@ pub fn signed_i16_hex(imm: i16) -> String { } else { (false, imm) }; - format!("{}{:#x}", sign, imm) + format!("{}{:#x}", if sign { "-" } else { "" } , imm) } pub fn signed_i32_hex(imm: i32) -> String { @@ -100,7 +100,7 @@ pub fn signed_i32_hex(imm: i32) -> String { } else { (false, imm) }; - format!("{}{:#x}", sign, imm) + format!("{}{:#x}", if sign { "-" } else { "" } , imm) } pub fn signed_i64_hex(imm: i64) -> String { @@ -111,5 +111,5 @@ pub fn signed_i64_hex(imm: i64) -> String { } else { (false, imm) }; - format!("{}{:#x}", sign, imm) + format!("{}{:#x}", if sign { "-" } else { "" } , imm) } |