ft: introduce modrm macro for leaner matching

All instructions which use a modrm instruction
for memory reads from or into a register can
make use of this macro
This commit is contained in:
2025-05-12 19:53:25 +09:00
parent 317b5e5db4
commit 51b28b3bac
4 changed files with 51 additions and 16 deletions

8
src/disasm_macros.rs Normal file
View File

@@ -0,0 +1,8 @@
#[macro_export]
/// Generate an Opcode for 'normal' ModRM instructions with mem access and a reg
macro_rules! modrm {
($self:ident, $variant:ident) => {{
let (idx, reg) = $self.parse_modrm_byte();
Opcode::$variant(idx, Register::by_id(reg))
}};
}