summaryrefslogtreecommitdiff
path: root/src/decode.rs
diff options
context:
space:
mode:
authortaitep <taitep@taitep.se>2025-12-27 11:48:36 +0100
committertaitep <taitep@taitep.se>2025-12-27 11:48:36 +0100
commit9f8e9ec380ad679fe714222345a46ebf77d063d6 (patch)
treebe4a990b220e52c9fcbd5c0abc95b45e2246d73c /src/decode.rs
parenta64fcaa3b557d3e7f611f3997a0b4c6990347d9b (diff)
Implement a GDB stub and fix another huge issue in S-type immediate decoding
Diffstat (limited to 'src/decode.rs')
-rw-r--r--src/decode.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/decode.rs b/src/decode.rs
index 4258a6f..d2e8a80 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -57,7 +57,9 @@ impl Instruction {
#[inline]
pub fn imm_s(self) -> DWord {
- (self.0 as i32 as i64 >> (25 - 5) & (0x7f << 5)) as DWord | (self.0 >> 7 & 0b11111) as DWord
+ let imm_11_5 = (self.0 as i32 as i64 >> 25 << 5) as DWord;
+ let imm_4_0 = (self.0 >> 7 & 0x1f) as DWord;
+ imm_11_5 | imm_4_0
}
#[inline]