aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2024-06-18 14:25:48 -0700
committeriximeow <me@iximeow.net>2024-06-18 14:25:48 -0700
commit53012e24ee9179a911cc6a3a8c4dc30cb9906c70 (patch)
treeb40cb21c5017580ae4ab9309897bd46fab188c96
parent4142a4a16b62ce9f80d796e930518c169c52d587 (diff)
mem size strings are all 7b or less
-rw-r--r--src/long_mode/display.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs
index 46227fb..d7a80cb 100644
--- a/src/long_mode/display.rs
+++ b/src/long_mode/display.rs
@@ -1198,7 +1198,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
Ok(())
}
fn visit_abs_u32(&mut self, imm: u32) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
if let Some(prefix) = self.instr.segment_override_for_op(self.op_nr) {
let name = prefix.name();
@@ -1209,7 +1209,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "[{}]", self.colors.address(u32_hex(imm)))
}
fn visit_abs_u64(&mut self, imm: u64) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
if let Some(prefix) = self.instr.segment_override_for_op(self.op_nr) {
let name = prefix.name();
@@ -1220,7 +1220,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "[{}]", self.colors.address(u64_hex(imm)))
}
fn visit_disp(&mut self, reg: RegSpec, disp: i32) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
if let Some(prefix) = self.instr.segment_override_for_op(self.op_nr) {
let name = prefix.name();
@@ -1263,7 +1263,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
self.f.write_fixed_size("]")
}
fn visit_deref(&mut self, reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
if let Some(prefix) = self.instr.segment_override_for_op(self.op_nr) {
let name = prefix.name();
@@ -1276,7 +1276,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
self.f.write_fixed_size("]")
}
fn visit_reg_scale(&mut self, reg: RegSpec, scale: u8) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
if let Some(prefix) = self.instr.segment_override_for_op(self.op_nr) {
let name = prefix.name();
@@ -1293,7 +1293,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
Ok(())
}
fn visit_reg_scale_disp(&mut self, reg: RegSpec, scale: u8, disp: i32) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
if let Some(prefix) = self.instr.segment_override_for_op(self.op_nr) {
let name = prefix.name();
@@ -1338,7 +1338,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "]")
}
fn visit_index_base_scale(&mut self, base: RegSpec, index: RegSpec, scale: u8) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
if let Some(prefix) = self.instr.segment_override_for_op(self.op_nr) {
let name = prefix.name();
@@ -1355,7 +1355,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
self.f.write_fixed_size("]")
}
fn visit_index_base_scale_disp(&mut self, base: RegSpec, index: RegSpec, scale: u8, disp: i32) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
if let Some(prefix) = self.instr.segment_override_for_op(self.op_nr) {
let name = prefix.name();
@@ -1402,7 +1402,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
self.f.write_fixed_size("]")
}
fn visit_reg_disp_masked(&mut self, spec: RegSpec, disp: i32, mask_reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
write!(self.f, "[{} ", regspec_label(&spec))?;
format_number_i32(self.colors, self.f, disp, NumberStyleHint::HexSignedWithSignSplit)?;
@@ -1410,7 +1410,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "{{{}}}", regspec_label(&mask_reg))
}
fn visit_reg_deref_masked(&mut self, spec: RegSpec, mask_reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
self.f.write_fixed_size("[")?;
self.f.write_str(regspec_label(&spec))?;
@@ -1418,7 +1418,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "{{{}}}", regspec_label(&mask_reg))
}
fn visit_reg_scale_masked(&mut self, spec: RegSpec, scale: u8, mask_reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
write!(self.f, "[{} * {}]",
regspec_label(&spec),
@@ -1427,7 +1427,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "{{{}}}", regspec_label(&mask_reg))
}
fn visit_reg_scale_disp_masked(&mut self, spec: RegSpec, scale: u8, disp: i32, mask_reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
write!(self.f, "[{} * {} ",
regspec_label(&spec),
@@ -1438,7 +1438,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "{{{}}}", regspec_label(&mask_reg))
}
fn visit_index_base_masked(&mut self, base: RegSpec, index: RegSpec, mask_reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
self.f.write_fixed_size("[")?;
self.f.write_str(regspec_label(&base))?;
@@ -1448,7 +1448,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "{{{}}}", regspec_label(&mask_reg))
}
fn visit_index_base_disp_masked(&mut self, base: RegSpec, index: RegSpec, disp: i32, mask_reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
write!(self.f, "[{} + {} ",
regspec_label(&base),
@@ -1459,7 +1459,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "{{{}}}", regspec_label(&mask_reg))
}
fn visit_index_base_scale_masked(&mut self, base: RegSpec, index: RegSpec, scale: u8, mask_reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
write!(self.f, "[{} + {} * {}]",
regspec_label(&base),
@@ -1469,7 +1469,7 @@ impl <T: DisplaySink, Y: YaxColors> crate::long_mode::OperandVisitor for Coloriz
write!(self.f, "{{{}}}", regspec_label(&mask_reg))
}
fn visit_index_base_scale_disp_masked(&mut self, base: RegSpec, index: RegSpec, scale: u8, disp: i32, mask_reg: RegSpec) -> Result<Self::Ok, Self::Error> {
- self.f.write_str(MEM_SIZE_STRINGS[self.instr.mem_size as usize])?;
+ unsafe { self.f.write_lt_8(MEM_SIZE_STRINGS[self.instr.mem_size as usize])? };
self.f.write_fixed_size(" ")?;
write!(self.f, "[{} + {} * {} ",
regspec_label(&base),