diff options
author | iximeow <me@iximeow.net> | 2024-04-02 00:54:58 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2024-04-02 00:54:58 -0700 |
commit | 3291884e4c51cfd93ae0f84681c5dd00e2e8544d (patch) | |
tree | 11176dad841e6983b9414c3ad5215994948d5c72 /src | |
parent | 27c0d462eec5200be1e4cc5a24353a66b97c159c (diff) |
display: gate rep printing with a simpler check
testing against six opcodes to see if we should print rep or repnz is a
bit absurd. they are relatively rare instructions, so this is a long
sequence of never-taken tests. we can avoid the whole thing in the
common case by testing if there is any kind of rep prefix at all.
Diffstat (limited to 'src')
-rw-r--r-- | src/long_mode/display.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs index c1c6c65..1a31073 100644 --- a/src/long_mode/display.rs +++ b/src/long_mode/display.rs @@ -3862,12 +3862,14 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St write!(out, "lock ")?; } - if [Opcode::MOVS, Opcode::CMPS, Opcode::LODS, Opcode::STOS, Opcode::INS, Opcode::OUTS].contains(&self.opcode) { - // only a few of you actually use the prefix... - if self.prefixes.rep() { - write!(out, "rep ")?; - } else if self.prefixes.repnz() { - write!(out, "repnz ")?; + if self.prefixes.rep_any() { + if [Opcode::MOVS, Opcode::CMPS, Opcode::LODS, Opcode::STOS, Opcode::INS, Opcode::OUTS].contains(&self.opcode) { + // only a few of you actually use the prefix... + if self.prefixes.rep() { + write!(out, "rep ")?; + } else if self.prefixes.repnz() { + write!(out, "repnz ")?; + } } } |