From f6ad0a91226b12cb7ec928dbbb6983ea0425d9e2 Mon Sep 17 00:00:00 2001 From: iximeow Date: Wed, 19 Jun 2024 00:54:03 -0700 Subject: hint better about codegen for contextualize_intel --- src/long_mode/display.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/long_mode') diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs index d0aef26..2404847 100644 --- a/src/long_mode/display.rs +++ b/src/long_mode/display.rs @@ -5826,6 +5826,9 @@ fn contextualize_intel(instr: &Instruction, out: &mut T) -> fmt: op_nr: i, f: out, }; + if i >= 4 { + unsafe { core::hint::unreachable_unchecked(); } + } instr.visit_operand(i as u8, &mut displayer)?; if let Some(evex) = instr.prefixes.evex() { let x = Operand::from_spec(instr, instr.operands[i as usize]); @@ -5873,7 +5876,15 @@ fn contextualize_intel(instr: &Instruction, out: &mut T) -> fmt: 0 } }; - write!(out, "{{1to{}}}", scale)?; + out.write_fixed_size("{1to")?; + static STRING_LUT: &'static [&'static str] = &[ + "0", "1", "2", "3", "4", "5", "6", "7", "8", + "9", "10", "11", "12", "13", "14", "15", "16", + ]; + unsafe { + out.write_lt_16(STRING_LUT.get_kinda_unchecked(scale as usize))?; + } + out.write_char('}')?; } } } -- cgit v1.1