aboutsummaryrefslogtreecommitdiff
path: root/src/long_mode/mod.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2024-04-02 00:42:29 -0700
committeriximeow <me@iximeow.net>2024-04-02 00:42:32 -0700
commit27c0d462eec5200be1e4cc5a24353a66b97c159c (patch)
tree596c9aedf55686153e6d7e1d10500b1c20421c1b /src/long_mode/mod.rs
parentbbdf78c061b6e685d1992dcdeac692fc2f8f0d34 (diff)
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)
Diffstat (limited to 'src/long_mode/mod.rs')
-rw-r--r--src/long_mode/mod.rs4
1 files changed, 2 insertions, 2 deletions
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