From b9819eb973208e9998a87cc54473efbcf281f4ad Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 25 May 2026 17:53:38 +0000 Subject: and some prefix helpers should be pub --- src/long_mode/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/long_mode/mod.rs') diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index f2fac5b..bfe67c3 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -3498,8 +3498,12 @@ impl Prefixes { fn set_repnz(&mut self) { self.bits = (self.bits & 0xcf) | 0x30 } #[inline] pub fn rep_any(&self) -> bool { self.bits & 0x30 != 0x00 } + /// return `true` if an operand-size (`66`) prefix is active for the instruction. + /// + /// this interacts in subtle ways with a REX prefix, if both are present. if you are tempted to + /// refine decode logic based the result of this function, please report that as an issue. #[inline] - fn operand_size(&self) -> bool { self.bits & 0x1 == 1 } + pub fn operand_size(&self) -> bool { self.bits & 0x1 == 1 } #[inline] fn set_operand_size(&mut self) { self.bits = self.bits | 0x1; @@ -3508,14 +3512,18 @@ impl Prefixes { fn unset_operand_size(&mut self) { self.bits = self.bits & !0x1; } + /// return `true` if an operand-size (67) prefix is active for the instruction. #[inline] - fn address_size(&self) -> bool { self.bits & 0x2 == 2 } + pub fn address_size(&self) -> bool { self.bits & 0x2 == 2 } #[inline] fn set_address_size(&mut self) { self.bits = self.bits | 0x2 } #[inline] fn set_lock(&mut self) { self.bits |= 0x4 } #[inline] pub fn lock(&self) -> bool { self.bits & 0x4 == 4 } + /// return the instruction's selected data segment. + #[inline] + pub fn segment(&self) -> Segment { self.segment } #[inline] pub fn cs(&self) -> bool { self.segment == Segment::CS } #[inline] -- cgit v1.1