aboutsummaryrefslogtreecommitdiff
path: root/src/long_mode/display.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2024-06-18 17:53:31 -0700
committeriximeow <me@iximeow.net>2024-06-18 17:53:31 -0700
commit1506b8fc0f58a7b1eb91009302b79750ff7cbc8b (patch)
tree83c25ad0ab371fa42d2e166d11d94e6774a13136 /src/long_mode/display.rs
parent8de036c2ac6777220a2d1d755036896ab295f7bb (diff)
use hex printer helpers for relative offsets too
Diffstat (limited to 'src/long_mode/display.rs')
-rw-r--r--src/long_mode/display.rs46
1 files changed, 2 insertions, 44 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs
index 95511f9..10f1db8 100644
--- a/src/long_mode/display.rs
+++ b/src/long_mode/display.rs
@@ -6336,27 +6336,7 @@ impl<'a, Y: YaxColors, F: DisplaySink> crate::long_mode::OperandVisitor for Rela
// danger_anguished_string_write(&mut self.out, "+");
}
self.out.write_fixed_size("0x")?;
- // danger_anguished_string_write(self.out, "0x");
- let mut buf = [core::mem::MaybeUninit::<u8>::uninit(); 2];
- let mut curr = buf.len();
- loop {
- let digit = v % 16;
- let c = c_to_hex(digit as u8);
- curr -= 1;
- buf[curr].write(c);
- v = v / 16;
- if v == 0 {
- break;
- }
- }
- let buf = &buf[curr..];
- let s = unsafe {
- core::mem::transmute::<&[core::mem::MaybeUninit<u8>], &str>(buf)
- };
-
- // not actually fixed size, but this should optimize right i hope..
- self.out.write_fixed_size(s)?;
-// anguished_string_write(&mut self.out, s);
+ self.out.write_u8(v)?;
Ok(true)
} else {
Ok(false)
@@ -6377,29 +6357,7 @@ impl<'a, Y: YaxColors, F: DisplaySink> crate::long_mode::OperandVisitor for Rela
// danger_anguished_string_write(&mut self.out, "+");
}
self.out.write_fixed_size("0x")?;
- // danger_anguished_string_write(self.out, "0x");
- let mut buf = [core::mem::MaybeUninit::<u8>::uninit(); 8];
- let mut curr = buf.len();
- loop {
- let digit = v % 16;
- let c = c_to_hex(digit as u8);
- curr -= 1;
- buf[curr].write(c);
- v = v / 16;
- if v == 0 {
- break;
- }
- }
- let buf = &buf[curr..];
- let s = unsafe {
- core::mem::transmute::<&[core::mem::MaybeUninit<u8>], &str>(buf)
- };
-
-// danger_anguished_string_write(&mut self.out, s);
-
- // danger_anguished_variable_length_bstring_write(unsafe { self.out.as_mut_vec() }, s.as_bytes());
- // not actually fixed size, but this should optimize right i hope..
- self.out.write_fixed_size(s)?;
+ self.out.write_u32(v)?;
Ok(true)
} else {
Ok(false)