pub struct Operand {
pub info: OpInfo,
pub size: OpSize,
pub access: OpAccess,
pub is_default: bool,
}
Expand description
Describes an instruction operand.
Each operand type encodes different information. See OpInfo
for details.
§Examples
use bddisasm::{DecodedInstruction, DecodeMode, OpRegType, OpSize};
// `MOV ah, byte ptr [rcx+rdx*2+0x8]`
let code = vec![0x8a, 0x64, 0x51, 0x08];
let ins = DecodedInstruction::decode(&code, DecodeMode::Bits64)?;
let operands = ins.operands();
let dst = operands[0];
let src = operands[1];
// Check the size of each operand
assert_eq!(dst.size, OpSize::Bytes(1));
assert_eq!(src.size, OpSize::Bytes(1));
// Check the type of the destination operand
assert!(dst.info.is_reg());
let dst_reg = dst.info.as_reg().unwrap();
assert_eq!(dst_reg.kind, OpRegType::Gpr);
Fields§
§info: OpInfo
Extended operand information.
size: OpSize
It indicates the actual amount of data used for processing. If the operand is a register, it MAY NOT indicate the register size. Use the info field to get the actual register size in these cases.
access: OpAccess
Access mode.
is_default: bool
true
if the operand is default. This also applies to implicit operands.
Trait Implementations§
source§impl PartialEq for Operand
impl PartialEq for Operand
impl Copy for Operand
impl Eq for Operand
impl StructuralPartialEq for Operand
Auto Trait Implementations§
impl RefUnwindSafe for Operand
impl Send for Operand
impl Sync for Operand
impl Unpin for Operand
impl UnwindSafe for Operand
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more