From 7d943d740afb6a42b50c979800608c6fb1614d0c Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 6 Jun 2022 20:36:05 -0700 Subject: Don't mask instruction bits No longer needed, since they are no longer sign-extended. Fixes #1022 by eliminating undefined behavior (64-bit instructions resulted in a shift amount equal to the datatype width). --- riscv/decode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'riscv/decode.h') diff --git a/riscv/decode.h b/riscv/decode.h index d56d496..72b4a6b 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -79,7 +79,7 @@ class insn_t public: insn_t() = default; insn_t(insn_bits_t bits) : b(bits) {} - insn_bits_t bits() { return b & ~((UINT64_MAX) << (length() * 8)); } + insn_bits_t bits() { return b; } int length() { return insn_length(b); } int64_t i_imm() { return xs(20, 12); } int64_t shamt() { return x(20, 6); } -- cgit v1.1