From c5f5fa1f75d09098d4a8b184a8db2a87b555ff00 Mon Sep 17 00:00:00 2001 From: Alexis Engelke Date: Fri, 24 Mar 2023 11:30:49 +0100 Subject: [PATCH] decode: Simplify ModRM reg vs. mem distiction --- decode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/decode.c b/decode.c index d806080..74244da 100644 --- a/decode.c +++ b/decode.c @@ -179,7 +179,7 @@ fd_decode(const uint8_t* buffer, size_t len_sz, int mode_int, uintptr_t address, if (table_entry & 1) { if (UNLIKELY(off >= len)) return FD_ERR_PARTIAL; - unsigned isreg = (buffer[off] & 0xc0) == 0xc0 ? 8 : 0; + unsigned isreg = buffer[off] >= 0xc0 ? 8 : 0; table_entry = table_walk(table_entry, ((buffer[off] >> 3) & 7) | isreg); // table_entry kinds: INSTR(0), T8E(1) if (table_entry & 1) @@ -314,7 +314,7 @@ fd_decode(const uint8_t* buffer, size_t len_sz, int mode_int, uintptr_t address, if (table_entry & 1) { if (UNLIKELY(off >= len)) return FD_ERR_PARTIAL; - unsigned isreg = (buffer[off] & 0xc0) == 0xc0 ? 8 : 0; + unsigned isreg = buffer[off] >= 0xc0 ? 8 : 0; table_entry = table_walk(table_entry, ((buffer[off] >> 3) & 7) | isreg); // table_entry kinds: INSTR(0), T8E(1), TVEX(2) if (table_entry & 1)