From b9a231239ddbe4ee1d35038e548295f146040f1d Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Fri, 18 Oct 2024 15:09:28 +0200 Subject: [PATCH] regs: add convenience getter methods for a registers --- src/reg/core_regs.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/reg/core_regs.rs b/src/reg/core_regs.rs index 5a9bc66..0887ee6 100644 --- a/src/reg/core_regs.rs +++ b/src/reg/core_regs.rs @@ -211,6 +211,17 @@ impl CoreRegs { } } + /// Get value from `a8` register. + pub fn a8(&self, idx: impl Into) -> Option { self.a8[idx.into().to_usize()] } + /// Get value from `a16` register. + pub fn a16(&self, idx: impl Into) -> Option { self.a16[idx.into().to_usize()] } + /// Get value from `a32` register. + pub fn a32(&self, idx: impl Into) -> Option { self.a32[idx.into().to_usize()] } + /// Get value from `a64` register. + pub fn a64(&self, idx: impl Into) -> Option { self.a64[idx.into().to_usize()] } + /// Get value from `a128` register. + pub fn a128(&self, idx: impl Into) -> Option { self.a128[idx.into().to_usize()] } + /// Extracts value for any type of registers pub fn get(&self, reg: impl Into) -> RegValue { match reg.into() {