diff --git a/disas/riscv.c b/disas/riscv.c index 36609efdf5..b8ec546883 100644 --- a/disas/riscv.c +++ b/disas/riscv.c @@ -5084,26 +5084,10 @@ static bool check_constraints(rv_decode *dec, const rvc_constraint *c) return true; } -/* instruction length */ - +/* Same as insn_len() from target/riscv/internals.h */ static size_t inst_length(rv_inst inst) { - /* NOTE: supports maximum instruction size of 64-bits */ - - /* - * instruction length coding - * - * aa - 16 bit aa != 11 - * bbb11 - 32 bit bbb != 111 - * 011111 - 48 bit - * 0111111 - 64 bit - */ - - return (inst & 0b11) != 0b11 ? 2 - : (inst & 0b11100) != 0b11100 ? 4 - : (inst & 0b111111) == 0b011111 ? 6 - : (inst & 0b1111111) == 0b0111111 ? 8 - : 0; + return (inst & 3) == 3 ? 4 : 2; } /* format instruction */