Skip to main content

osom_encoders_x86_64/models/
gpr_or_memory.rs

1use super::{GPR, Memory};
2
3/// Represents a GPR or memory operand.
4#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)]
5#[repr(u8)]
6pub enum GPROrMemory {
7    GPR { gpr: GPR } = 1,
8    Memory { memory: Memory } = 2,
9}
10
11impl From<GPR> for GPROrMemory {
12    fn from(gpr: GPR) -> Self {
13        GPROrMemory::GPR { gpr }
14    }
15}
16
17impl From<Memory> for GPROrMemory {
18    fn from(memory: Memory) -> Self {
19        GPROrMemory::Memory { memory }
20    }
21}