From 27c0d462eec5200be1e4cc5a24353a66b97c159c Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 2 Apr 2024 00:42:29 -0700 Subject: swap test order for segment override applicability it is almost always the case that self.prefixes.segment == Segment::DS, meaning testing for it first avoids checking `self.operands[op].is_memory()` later. this overall avoids a few instructions in the typical path, rather than checking `is_memory()` first (which would always be true in the places this function is called from) --- src/long_mode/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index f58976a..5bdd786 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -4400,8 +4400,8 @@ impl Instruction { }, _ => { // most operands are pretty simple: - if self.operands[op as usize].is_memory() && - self.prefixes.segment != Segment::DS { + if self.prefixes.segment != Segment::DS && + self.operands[op as usize].is_memory() { Some(self.prefixes.segment) } else { None -- cgit v1.1