aboutsummaryrefslogtreecommitdiff
path: root/src/long_mode
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2020-02-11 00:12:45 -0800
committeriximeow <me@iximeow.net>2020-02-11 00:12:45 -0800
commitf08c8bbf9f180283490fc7a4e116e8fa0ffcc681 (patch)
tree7a52640ef668531a03087abb30c73dddc8993470 /src/long_mode
parent076d2fa68216533b54a3c514433226b6ac77b50d (diff)
derive Ord and PartialOrd for RegSpec and RegisterBank
this makes these usable as keys in collections such as BTreeMap. there is no specific ordering imposed by Ord (f.ex it may be the case that `eax > dx` while `eax > rax`), but some specific ordering may be imposed in the future.
Diffstat (limited to 'src/long_mode')
-rw-r--r--src/long_mode/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index be2dbeb..099cc47 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -6,13 +6,13 @@ use core::hint::unreachable_unchecked;
use yaxpeax_arch::{Decoder, LengthedInstruction};
#[cfg(feature="use-serde")]
-#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
+#[derive(Copy, Clone, Debug, PartialOrd, Ord, Eq, PartialEq, Serialize, Deserialize)]
pub struct RegSpec {
pub num: u8,
pub bank: RegisterBank
}
#[cfg(not(feature="use-serde"))]
-#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[derive(Copy, Clone, Debug, PartialOrd, Ord, Eq, PartialEq)]
pub struct RegSpec {
pub num: u8,
pub bank: RegisterBank
@@ -364,7 +364,7 @@ fn operand_size() {
#[allow(non_camel_case_types)]
#[cfg(feature="use-serde")]
-#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
+#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum RegisterBank {
Q, D, W, B, rB, // Quadword, Dword, Word, Byte
CR, DR, S, EIP, RIP, EFlags, RFlags, // Control reg, Debug reg, Selector, ...
@@ -374,7 +374,7 @@ pub enum RegisterBank {
}
#[allow(non_camel_case_types)]
#[cfg(not(feature="use-serde"))]
-#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
+#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub enum RegisterBank {
Q, D, W, B, rB, // Quadword, Dword, Word, Byte
CR, DR, S, EIP, RIP, EFlags, RFlags, // Control reg, Debug reg, Selector, ...